Skip to main content
GameDev.net gamedev.net
🔒 Locked

[.net] TCPClient.Close()

Started by Kenster Aug 22, 2008 at 1:36 PM 1 replies 1.2k views
Original Post
Kenster
Kenster
I've read many guides on Google about how sometimes with get a WAIT_CLOSE even after we call TcpClient.Close(). I think I am having the same issue. I know its getting disconnected as CONNECTED goes to false, and also because in-game movement/talking/recieveing packets no longer works. Though, when I get fully disconnect it should say 'You have been disconnected from the server'. When I do .Close(). I don't get that message. Though when I close my program completly the message appears, so I know the message works. So I assume its closes, but not 100%. Any way I can get some Debug on this, or maybe anyone have this issue with a solution. Thanks all.
furin591
furin591
You need to close the actual networkstream of the client and then close the client. Try that and see if it helps.


NetworkStream streamToClose = tcpClientObject.GetStream();streamToClose.Close();tcpClientObject.close();

Kenster
Kenster
Nope. Using ProcessExplorer, the TCPClient is in FIN_WAIT2 State after your code has ran.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.