Hi.
I'm making a server/client project where a client can connect to my server and be able to chat and stuff.
I seem to be having trouble with something that confuses me. If I connect my client to the server, then exit the client, and then try to re-connect, I get an error saying "cannot access a disposed object".
This is my code right here
and this is where I seem to get my errorCode:public static void ClientThread(TcpClient nClient) { while (nClient.Connected) { if (nClient.Client.Poll(20, SelectMode.SelectRead) == true && nClient.Available == 0) //To handle D/C { break; //Exit loop } if (nClient.Available > 0) { BufferHandler.HandleBuffer(); } } }
Sockets and TcpClients really confuse me so if someone could help me out that would be awesome!Code:if (nClient.Client.Poll(20, SelectMode.SelectRead) == true && nClient.Available == 0) //To handle D/C
thanks


Reply With Quote
Bookmarks