Click here to Skip to main content
15,905,419 members
Home / Discussions / C#
   

C#

 
QuestionDLL and C# classes Pin
ScotDolan10-Feb-09 4:36
ScotDolan10-Feb-09 4:36 
AnswerRe: DLL and C# classes Pin
led mike10-Feb-09 4:49
led mike10-Feb-09 4:49 
Questiongroup/ungroup of graphic objects.... Pin
priyareguri10-Feb-09 4:31
priyareguri10-Feb-09 4:31 
AnswerRe: group/ungroup of graphic objects.... Pin
musefan10-Feb-09 4:36
musefan10-Feb-09 4:36 
QuestionCannot implicitly convert type 'System.Drawing.Image' to 'string' Pin
abbd10-Feb-09 4:28
abbd10-Feb-09 4:28 
AnswerRe: Cannot implicitly convert type 'System.Drawing.Image' to 'string' Pin
vaghelabhavesh10-Feb-09 4:48
vaghelabhavesh10-Feb-09 4:48 
GeneralRe: Cannot implicitly convert type 'System.Drawing.Image' to 'string' Pin
abbd10-Feb-09 4:54
abbd10-Feb-09 4:54 
QuestionWhy do i get This Error ?????? Pin
snouto10-Feb-09 3:40
snouto10-Feb-09 3:40 
i have a server and client networked application , each time i test them , gives me an error "Unable to read data from the transport connection: The I/O operation has been aborted because of either a thread exit or an application request.
"

Here is the code for the client , knowing that the server doesn't disconnect the current client , the server still see the client as connected

the client code as follows :

<br />
<br />
<br />
<br />
<br />
<br />
void RunClient()<br />
        {<br />
            try<br />
            {<br />
                IPAddress ip = IPAddress.Parse("127.0.0.1");<br />
<br />
                int port = 5079;<br />
<br />
                IPEndPoint ipendpoint = new IPEndPoint(ip, 5079);<br />
<br />
                //create the tcp client<br />
                client = new TcpClient();<br />
<br />
                client.Connect(ipendpoint);<br />
<br />
                Console.WriteLine("The Client has been Connected Successfully");<br />
<br />
                //begin Reading <br />
                lock (client.GetStream())<br />
                {<br />
                    (client.GetStream()).BeginRead(data, 0, data.Length, new AsyncCallback(IASyncResultCallBack), client);<br />
                }<br />
                <br />
<br />
            }<br />
            catch (Exception s)<br />
            {<br />
                this.Invoke(new SetText(SetTextMethod), new object[] { s.Message });<br />
            }<br />
        }<br />
<br />
 void IASyncResultCallBack(IAsyncResult ar)<br />
        {<br />
            try<br />
            {<br />
                //get the tcp client instance<br />
                TcpClient currentclient = ar.AsyncState as TcpClient;<br />
<br />
                if (currentclient != null)<br />
                {<br />
                    if (currentclient.GetStream().CanRead)<br />
                    {<br />
                        //get the instance of the data<br />
                        int count = (currentclient.GetStream()).EndRead(ar);<br />
<br />
                        if (count <= 0)<br />
                        {<br />
                            //disconnect the current client<br />
                            currentclient.Close();<br />
                            currentclient = null;<br />
                            GC.Collect();<br />
                            return;<br />
                        }<br />
                        //build the Received Text<br />
<br />
                        ReadText(data, 0, data.Length);<br />
                    }<br />
                }<br />
<br />
                //now begin Reading again<br />
<br />
                lock (currentclient.GetStream())<br />
                {<br />
                    currentclient.GetStream().BeginRead(data, 0, data.Length, new AsyncCallback(IASyncResultCallBack), currentclient);<br />
                }<br />
            }<br />
            catch (Exception s)<br />
            {<br />
                this.Invoke(new SetText(SetTextMethod), new object[] { s.Message });<br />
            }<br />
        }<br />



The error is in the following line of code
<br />
 int count = (currentclient.GetStream()).EndRead(ar);<br />
<br />
br mode="hold" />when the compiler executes the following code it jumps to the next catch block giving the above error statement .

so what is wrong ????

Human knowledge belongs to the world.

AnswerRe: Why do i get This Error ?????? Pin
Nagy Vilmos10-Feb-09 3:47
professionalNagy Vilmos10-Feb-09 3:47 
Questionconversion of strings Pin
Markie O'man10-Feb-09 3:06
Markie O'man10-Feb-09 3:06 
AnswerRe: conversion of strings Pin
Ennis Ray Lynch, Jr.10-Feb-09 3:22
Ennis Ray Lynch, Jr.10-Feb-09 3:22 
QuestionDataGrid Pin
mrithula810-Feb-09 2:39
mrithula810-Feb-09 2:39 
AnswerRe: DataGrid Pin
vaghelabhavesh10-Feb-09 3:27
vaghelabhavesh10-Feb-09 3:27 
AnswerRe: DataGrid Pin
musefan10-Feb-09 3:54
musefan10-Feb-09 3:54 
QuestionContent Type Pin
Stephen Lintott10-Feb-09 2:31
Stephen Lintott10-Feb-09 2:31 
AnswerRe: Content Type Pin
Ennis Ray Lynch, Jr.10-Feb-09 3:24
Ennis Ray Lynch, Jr.10-Feb-09 3:24 
GeneralRe: Content Type Pin
Stephen Lintott10-Feb-09 3:51
Stephen Lintott10-Feb-09 3:51 
GeneralRe: Content Type Pin
J4amieC10-Feb-09 4:06
J4amieC10-Feb-09 4:06 
GeneralRe: Content Type Pin
Stephen Lintott10-Feb-09 19:11
Stephen Lintott10-Feb-09 19:11 
QuestionHow to clone a network in c#? Pin
Harish (Developer)10-Feb-09 2:25
Harish (Developer)10-Feb-09 2:25 
AnswerRe: How to clone a network in c#? Pin
ABitSmart10-Feb-09 2:43
ABitSmart10-Feb-09 2:43 
GeneralRe: How to clone a network in c#? Pin
Harish (Developer)10-Feb-09 18:21
Harish (Developer)10-Feb-09 18:21 
QuestionEncode Word file to base 64 digits Pin
abbd10-Feb-09 2:25
abbd10-Feb-09 2:25 
AnswerRe: Encode Word file to base 64 digits Pin
Rob Philpott10-Feb-09 3:38
Rob Philpott10-Feb-09 3:38 
GeneralRe: Encode Word file to base 64 digits Pin
abbd10-Feb-09 3:58
abbd10-Feb-09 3:58 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.