Add method to close socket. NOTE: This change BREAKS THINGS and the demo NO LONGER FUNCTIONS. The problem is however unrelated to the commit--this code simply reveals an already existing bug due to the socket number being uninitialised. Now I've found out why the problem occurs I can fix it in the next commit.

git-svn-id: svn+ssh://oldsvn/home/mlalondesvn/svn/cral@104 3ee9b42a-b53c-0410-a25e-f0b6218d5d5b
master
follower 17 years ago
parent e4dfd94a4c
commit 8247d829a2

@ -228,6 +228,7 @@ class NetworkConnection { // Essentially a Socket wrapper
void listen(); // TODO: Return a useful value? void listen(); // TODO: Return a useful value?
int isConnected(); int isConnected();
void NetworkConnection::close();
private: private:
SOCKET _socket; SOCKET _socket;
@ -256,6 +257,15 @@ int NetworkConnection::isConnected() {
return (getSn_SR(_socket) == SOCK_ESTABLISHED); return (getSn_SR(_socket) == SOCK_ESTABLISHED);
} }
void NetworkConnection::close() {
/*
*/
::close(_socket);
disconnect(_socket);
}
/* ----------------------- */ /* ----------------------- */
/* -- NetworkInterface -- */ /* -- NetworkInterface -- */

Loading…
Cancel
Save