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?
int isConnected();
void NetworkConnection::close();
private:
SOCKET _socket;
@ -236,7 +237,7 @@ class NetworkConnection { // Essentially a Socket wrapper
NetworkConnection::NetworkConnection(uint16_t port) {
/*
*/
*/
socket(_socket, Sn_MR_TCP, port, 0);
}
@ -256,6 +257,15 @@ int NetworkConnection::isConnected() {
return (getSn_SR(_socket) == SOCK_ESTABLISHED);
}
void NetworkConnection::close() {
/*
*/
::close(_socket);
disconnect(_socket);
}
/* ----------------------- */
/* -- NetworkInterface -- */

Loading…
Cancel
Save