aboutsummaryrefslogtreecommitdiff
path: root/src/socket.cpp
diff options
context:
space:
mode:
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{