aboutsummaryrefslogtreecommitdiff
path: root/src/socket.cpp
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2007-07-03 00:50:59 +0000
committerMike Buland <eichlan@xagasoft.com>2007-07-03 00:50:59 +0000
commitf7f45e9630912cfca6b3a6b60577f02924c3dbc9 (patch)
treebac0b1088b3bcd4407417dbf20a69812c1b8f2e5 /src/socket.cpp
parent395a9f1b8ce44d55dbe4496ce34e1ec6a6e2a3ba (diff)
downloadlibbu++-f7f45e9630912cfca6b3a6b60577f02924c3dbc9.tar.gz
libbu++-f7f45e9630912cfca6b3a6b60577f02924c3dbc9.tar.bz2
libbu++-f7f45e9630912cfca6b3a6b60577f02924c3dbc9.tar.xz
libbu++-f7f45e9630912cfca6b3a6b60577f02924c3dbc9.zip
Ah, that explains much, I did the big reorg -> trunk move and forgot to commit
some things, so here they are, after being manually copied.
Diffstat (limited to 'src/socket.cpp')
-rw-r--r--src/socket.cpp23
1 files changed, 20 insertions, 3 deletions
diff --git a/src/socket.cpp b/src/socket.cpp
index e567061..221d4c2 100644
--- a/src/socket.cpp
+++ b/src/socket.cpp
@@ -174,9 +174,26 @@ size_t Bu::Socket::read( void *pBuf, size_t nBytes )
174 return nRead; 174 return nRead;
175} 175}
176 176
177//size_t Bu::Socket::read( void *pBuf, size_t nBytes, uint32_t nTimeout ) 177size_t Bu::Socket::read( void *pBuf, size_t nBytes,
178//{ 178 uint32_t nSec, uint32_t nUSec )
179//} 179{
180 fd_set rfds;
181 FD_ZERO(&rfds);
182 FD_SET(nSocket, &rfds);
183 struct timeval tv = { nSec, nUSec };
184 int retval = select( nSocket+1, &rfds, NULL, NULL, &tv );
185 if( retval == -1 )
186 throw ConnectionException(
187 excodeBadReadError,
188 "Bad Read error"
189 );
190 if( !FD_ISSET( nSocket, &rfds ) )
191 throw ConnectionException(
192 excodeSocketTimeout,
193 "Socket timout on read"
194 );
195 return read( pBuf, nBytes );
196}
180 197
181size_t Bu::Socket::write( const void *pBuf, size_t nBytes ) 198size_t Bu::Socket::write( const void *pBuf, size_t nBytes )
182{ 199{