470,636 Members | 1,462 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,636 developers. It's quick & easy.

Network stream error "Unable to read data from the transport connection."


I'm trying to make a simple socket application, something like a chat
application, but when I run it, it shows the following error when the client
connects to the server: "Unable to read data from the transport
connection.". I'm posting the code, so if somebody can help I'll be very

private void DoListen()
Client = Server.AcceptTcpClient();
state = SocketState.Connected;
stream = Client.GetStream();
stream.BeginRead(dataBytes,0,dataBytes.Length, new
state = SocketState.Closed;

private void ReadStream (IAsyncResult args)
if (state == SocketState.Connected)
int I;
I = stream.EndRead(args); // The error happens here!!!
if (I > 0)
data = Encoding.ASCII.GetString(dataBytes);
stream.BeginRead(dataBytes,0,dataBytes.Length, new

Nov 15 '05 #1
0 3056

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Loane Sharp | last post: by
1 post views Thread by mulham.haffar | last post: by
3 posts views Thread by carmelo8 | last post: by
1 post views Thread by Stoney L | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.