From 8247d829a27f0befab3d9b7b23aa1f791e51492b Mon Sep 17 00:00:00 2001 From: follower Date: Tue, 11 Dec 2007 10:41:31 +0000 Subject: [PATCH] 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 --- .../follower/wiz810mj/src/demo/WizDemo4/WizDemo4.pde | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/branches/follower/wiz810mj/src/demo/WizDemo4/WizDemo4.pde b/branches/follower/wiz810mj/src/demo/WizDemo4/WizDemo4.pde index 6d21105..7f8ff7a 100644 --- a/branches/follower/wiz810mj/src/demo/WizDemo4/WizDemo4.pde +++ b/branches/follower/wiz810mj/src/demo/WizDemo4/WizDemo4.pde @@ -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 -- */