Ive started to develop a multiplayer game, its going well, only just started though. I have one problem that I cant exactly get my head around though.
When a client connects to the game server several messages are sent back and fouth between the client and server in order to establish a connection (like a sequence of verify bytes, version information, login details).
Say if though, the versions between the client/server are different and the error of "Different client/server version." displays on the game client. How would I cancel/close the sockets which I have created in a correct manner. Right now I am just closing the socket (.net's TcpClient) on both the server and the client. But the thing is once the TcpClient is closed on one end it also closes automatically on the other end (due to the transmission control protocol id issume, or winsock).
Question: How would I close these sockets correctly on both ends?
I hope you understand what I am saying,
All replies are appriciated.
Thanks,
Xanather.
Correctly establishing a server/client connection
Look up the shutdown() function.
Note that the socket itself doesn't get "closed" on the other end, just made an error to write to it. You still need to close()/closesocket() the socket handle to reclaim the kernel file descriptor/handle.
Note that the socket itself doesn't get "closed" on the other end, just made an error to write to it. You still need to close()/closesocket() the socket handle to reclaim the kernel file descriptor/handle.
Look up the shutdown() function.[/quote]
Ok, will do.
What do you mean by it doesnt get closed if the socket had a error to writing/reading? With .net's TcpClient the .Connected property always returns true until a read/write failes (even once) so thats strange.
Xanather.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement