How can I to determine when socket connected to my TcpClient is close connection? I do this... IPAddress ipAddress = Dns.Resolve(Dns.GetHostName()).AddressList[0]; TCPListiner = new TcpListener(ipAddress,PortNumber); TCPListiner.Start(); while(true) { if (TCPListiner.Pending()) { TcpClient TCPClient = TCPListiner.AcceptTcpClient(); NetworkStream LNS = TCPClient.GetStream(); } }
then I send some text throw NetworkStream LNS. Client can close connection. And result this.... System.IO.IOException: Unable to write data to the transport connection. ---> System.Net.Sockets.SocketException: An established connection was aborted by the software in your host machine at System.Net.Sockets.Socket.Send(Byte[] buffer, Int32 offset, Int32 size, So cketFlags socketFlags) at System.Net.Sockets.NetworkStream.Write(Byte[] buffer, Int32 offset, Int32 size) --- End of inner exception stack trace --- at System.Net.Sockets.NetworkStream.Write(Byte[] buffer, Int32 offset, Int32 size)
nikulin_andrey
Posts
-
I have a problem with TcpClient.... -
C# and comm port... How?How can I work in C# with Comm Port? I need send some data to Comm Port and then read answer... Please help me. Sorry my English.:(
-
How I can Check keyboard buffer?This sample doesn't work. The best overloaded method match for 'System.IO.StreamReader.StreamReader(System.IO.Stream)' has some invalid arguments Argument '1': cannot convert from 'System.IO.TextReader' to 'System.IO.Stream' :zzz:
-
How I can Check keyboard buffer?Hi! Please help me! I hava a problem. How I can check Keyboard buffer is empty or not? For instance do { // do something } while (CharFromKeyBoard != "q"); System.Read and SystemReadLine waiting user input, but I need do some operation until user press some key, for instance char "q". Sorry my English.
-
How I can draw bitmap on window caption ?How I can draw bitmap on window caption ? I want draw picture near system button[minimize,maximize,close]. Sorry my english!