diff options
author | Pixel <Pixel> | 2001-12-03 17:19:39 +0000 |
---|---|---|
committer | Pixel <Pixel> | 2001-12-03 17:19:39 +0000 |
commit | 0fd3b447119000a3b29fd46fed6b955198e5d7de (patch) | |
tree | 130fad408c5c1657355884453624e226279fa3ab /lib/Socket.cc | |
parent | ebdeb96f4f8275ab45cf9819cb3624dcf49a1b2b (diff) |
Zlib done...
Diffstat (limited to 'lib/Socket.cc')
-rw-r--r-- | lib/Socket.cc | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/lib/Socket.cc b/lib/Socket.cc index a8c5beb..1d93bb5 100644 --- a/lib/Socket.cc +++ b/lib/Socket.cc @@ -13,7 +13,7 @@ #include "Output.h" #include "config.h" -Socket::Socket() throw (GeneralException) : Handle(socket(AF_INET, SOCK_STREAM, 0)), connected(false), listening(false) { +Socket::Socket() throw (GeneralException) : Handle(socket(AF_INET, SOCK_STREAM, 0)), connected(false), listening(false), writeclosed(false), readclosed(false) { if (GetHandle() < 0) { throw GeneralException(_("Error creating socket.")); } @@ -34,13 +34,26 @@ bool Socket::IsListening(void) { } bool Socket::CanRead(void) { - return connected; + return connected && !readclosed; } bool Socket::CanWrite(void) { - return connected; + return connected && !writeclosed; } +void Socket::CloseWrite(void) { + if (!writeclosed) { + writeclosed = true; + shutdown(GetHandle(), 1); + } +} + +void Socket::CloseRead(void) { + if (!readclosed) { + readclosed = true; + shutdown(GetHandle(), 0); + } +} /***********************************************\ * Toute la suite n'est pas à décrire. Consulter * |