As the topic describes, how to do this?
I've just implemented a network handler for my game, and bound it to the games consoles commandlist as "connect" and "disconnect" wich simply connects and disconnects to a server.
But how to do this in nonblocking mode so that i can connect, then disconnect, and then connect again? I got an error when trying to connect to an already disconnected socket(first that socket wasnt ready, then when trying to do it again, its just error), so i simply made the socket a pointer instead of an object, and on the connect function i made it create a new tcpsocket, and on the disconnect i set it to NULL. This works, but is this really the proper way? Isn't there like a clear or reset function or something?
Maybe my methodics are wrong?
Here is the code for the clientside, the connect and disconnect functions(this works):
Connect:
https://legacy.sfmluploads.org/index.php?page=view_code&id=48Disconnect:
https://legacy.sfmluploads.org/index.php?page=view_code&id=49