Add rough hacky method to allow multiple sockets to be created. This needs to be fixed to (a) not create more than MAX sockets and (b) reuse sockets that have been closed. TODO: DO THIS PROPERLY\!

git-svn-id: svn+ssh://oldsvn/home/mlalondesvn/svn/cral@119 3ee9b42a-b53c-0410-a25e-f0b6218d5d5b
master
follower 17 years ago
parent a1e0e9864b
commit b2ed21239a

@ -234,13 +234,17 @@ class NetworkConnection { // Essentially a Socket wrapper
private: private:
SOCKET _socket; SOCKET _socket;
static const int _MAX_SOCKETS = MAX_SOCK_NUM; // TODO: Use this. static const int _MAX_SOCKETS = MAX_SOCK_NUM; // TODO: Use this.
static int _nextSocket;
}; };
int NetworkConnection::_nextSocket = 0;
NetworkConnection::NetworkConnection(uint16_t port) { NetworkConnection::NetworkConnection(uint16_t port) {
/* /*
*/ */
_socket = 0; // TODO: Do properly _socket = _nextSocket; // TODO: Do properly (& max)
_nextSocket++;
socket(_socket, Sn_MR_TCP, port, 0); socket(_socket, Sn_MR_TCP, port, 0);
} }

Loading…
Cancel
Save