(svn r15971) -Codechange: make it possible for UDP socket handlers to bind to multiple sockets.

This commit is contained in:
rubidium
2009-04-07 20:27:13 +00:00
parent 6db7f15b3a
commit 2a6e9288fd
7 changed files with 103 additions and 94 deletions

View File

@@ -37,12 +37,9 @@ struct Packet;
*/
class NetworkSocketHandler {
bool has_quit; ///< Whether the current client has quit/send a bad packet
public:
/* TODO: make socket protected once the TCP stuff is in a real class too */
SOCKET sock; ///< The socket currently connected to
public:
/** Create a new unbound socket */
NetworkSocketHandler(SOCKET s = INVALID_SOCKET) { this->sock = s; this->has_quit = false; }
NetworkSocketHandler() { this->has_quit = false; }
/** Close the socket when distructing the socket handler */
virtual ~NetworkSocketHandler() { this->Close(); }
@@ -57,12 +54,6 @@ public:
*/
virtual NetworkRecvStatus CloseConnection() { this->has_quit = true; return NETWORK_RECV_STATUS_OKAY; }
/**
* Whether this socket is currently bound to a socket.
* @return true when the socket is bound, false otherwise
*/
bool IsConnected() const { return this->sock != INVALID_SOCKET; }
/**
* Whether the current client connected to the socket has quit.
* In the case of UDP, for example, once a client quits (send bad