diff options
author | Mike Buland <eichlan@xagasoft.com> | 2011-01-19 23:02:44 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2011-01-19 23:02:44 +0000 |
commit | 10c557562e1d67c55314c212371ea9cb7f802863 (patch) | |
tree | 5834f4060874de33df5d0f9ebe115059d2541189 /src/tcpsocket.cpp | |
parent | dfb29c814b9c3327df3ab90e333b43504768e6d6 (diff) | |
download | libbu++-10c557562e1d67c55314c212371ea9cb7f802863.tar.gz libbu++-10c557562e1d67c55314c212371ea9cb7f802863.tar.bz2 libbu++-10c557562e1d67c55314c212371ea9cb7f802863.tar.xz libbu++-10c557562e1d67c55314c212371ea9cb7f802863.zip |
Started work adding more functions to stream, and changing to a new size type.
Diffstat (limited to 'src/tcpsocket.cpp')
-rw-r--r-- | src/tcpsocket.cpp | 40 |
1 files changed, 28 insertions, 12 deletions
diff --git a/src/tcpsocket.cpp b/src/tcpsocket.cpp index bbd9cf5..22acdf7 100644 --- a/src/tcpsocket.cpp +++ b/src/tcpsocket.cpp | |||
@@ -149,7 +149,7 @@ void Bu::TcpSocket::close() | |||
149 | bActive = false; | 149 | bActive = false; |
150 | } | 150 | } |
151 | 151 | ||
152 | size_t Bu::TcpSocket::read( void *pBuf, size_t nBytes ) | 152 | Bu::size Bu::TcpSocket::read( void *pBuf, Bu::size nBytes ) |
153 | { | 153 | { |
154 | fd_set rfds; | 154 | fd_set rfds; |
155 | FD_ZERO(&rfds); | 155 | FD_ZERO(&rfds); |
@@ -195,11 +195,11 @@ size_t Bu::TcpSocket::read( void *pBuf, size_t nBytes ) | |||
195 | return 0; | 195 | return 0; |
196 | } | 196 | } |
197 | 197 | ||
198 | size_t Bu::TcpSocket::read( void *pBuf, size_t nBytes, | 198 | Bu::size Bu::TcpSocket::read( void *pBuf, Bu::size nBytes, |
199 | uint32_t nSec, uint32_t nUSec ) | 199 | uint32_t nSec, uint32_t nUSec ) |
200 | { | 200 | { |
201 | struct timeval tv; | 201 | struct timeval tv; |
202 | size_t nRead = 0; | 202 | Bu::size nRead = 0; |
203 | 203 | ||
204 | fd_set rfds; | 204 | fd_set rfds; |
205 | FD_ZERO(&rfds); | 205 | FD_ZERO(&rfds); |
@@ -239,7 +239,7 @@ size_t Bu::TcpSocket::read( void *pBuf, size_t nBytes, | |||
239 | return nRead; | 239 | return nRead; |
240 | } | 240 | } |
241 | 241 | ||
242 | size_t Bu::TcpSocket::write( const void *pBuf, size_t nBytes ) | 242 | Bu::size Bu::TcpSocket::write( const void *pBuf, Bu::size nBytes ) |
243 | { | 243 | { |
244 | //#ifdef WIN32 | 244 | //#ifdef WIN32 |
245 | int nWrote = TEMP_FAILURE_RETRY( | 245 | int nWrote = TEMP_FAILURE_RETRY( |
@@ -261,10 +261,10 @@ size_t Bu::TcpSocket::write( const void *pBuf, size_t nBytes ) | |||
261 | return nWrote; | 261 | return nWrote; |
262 | } | 262 | } |
263 | 263 | ||
264 | size_t Bu::TcpSocket::write( const void *pBuf, size_t nBytes, uint32_t nSec, uint32_t nUSec ) | 264 | Bu::size Bu::TcpSocket::write( const void *pBuf, Bu::size nBytes, uint32_t nSec, uint32_t nUSec ) |
265 | { | 265 | { |
266 | struct timeval tv; | 266 | struct timeval tv; |
267 | size_t nWrote = 0; | 267 | Bu::size nWrote = 0; |
268 | 268 | ||
269 | fd_set wfds; | 269 | fd_set wfds; |
270 | FD_ZERO(&wfds); | 270 | FD_ZERO(&wfds); |
@@ -304,22 +304,22 @@ size_t Bu::TcpSocket::write( const void *pBuf, size_t nBytes, uint32_t nSec, uin | |||
304 | return nWrote; | 304 | return nWrote; |
305 | } | 305 | } |
306 | 306 | ||
307 | long Bu::TcpSocket::tell() | 307 | Bu::size Bu::TcpSocket::tell() |
308 | { | 308 | { |
309 | throw UnsupportedException(); | 309 | throw UnsupportedException(); |
310 | } | 310 | } |
311 | 311 | ||
312 | void Bu::TcpSocket::seek( long ) | 312 | void Bu::TcpSocket::seek( Bu::size ) |
313 | { | 313 | { |
314 | throw UnsupportedException(); | 314 | throw UnsupportedException(); |
315 | } | 315 | } |
316 | 316 | ||
317 | void Bu::TcpSocket::setPos( long ) | 317 | void Bu::TcpSocket::setPos( Bu::size ) |
318 | { | 318 | { |
319 | throw UnsupportedException(); | 319 | throw UnsupportedException(); |
320 | } | 320 | } |
321 | 321 | ||
322 | void Bu::TcpSocket::setPosEnd( long ) | 322 | void Bu::TcpSocket::setPosEnd( Bu::size ) |
323 | { | 323 | { |
324 | throw UnsupportedException(); | 324 | throw UnsupportedException(); |
325 | } | 325 | } |
@@ -401,7 +401,7 @@ void Bu::TcpSocket::setBlocking( bool bBlocking ) | |||
401 | fcntl( nTcpSocket, F_SETFL, fcntl( nTcpSocket, F_GETFL, 0 ) | O_NONBLOCK ); | 401 | fcntl( nTcpSocket, F_SETFL, fcntl( nTcpSocket, F_GETFL, 0 ) | O_NONBLOCK ); |
402 | } | 402 | } |
403 | #else | 403 | #else |
404 | u_long iMode; | 404 | u_Bu::size iMode; |
405 | if( bBlocking ) | 405 | if( bBlocking ) |
406 | iMode = 0; | 406 | iMode = 0; |
407 | else | 407 | else |
@@ -416,7 +416,7 @@ void Bu::TcpSocket::setBlocking( bool bBlocking ) | |||
416 | #endif | 416 | #endif |
417 | } | 417 | } |
418 | 418 | ||
419 | void Bu::TcpSocket::setSize( long ) | 419 | void Bu::TcpSocket::setSize( Bu::size ) |
420 | { | 420 | { |
421 | } | 421 | } |
422 | 422 | ||
@@ -436,6 +436,8 @@ void Bu::TcpSocket::setAddress() | |||
436 | addr.sin_family = AF_INET; | 436 | addr.sin_family = AF_INET; |
437 | bu_getpeername( nTcpSocket, (sockaddr *)(&addr), &len ); | 437 | bu_getpeername( nTcpSocket, (sockaddr *)(&addr), &len ); |
438 | sAddress = bu_inet_ntoa( addr.sin_addr ); | 438 | sAddress = bu_inet_ntoa( addr.sin_addr ); |
439 | |||
440 | printf("%d\n", IP_MTU ); | ||
439 | } | 441 | } |
440 | 442 | ||
441 | Bu::FString Bu::TcpSocket::getAddress() const | 443 | Bu::FString Bu::TcpSocket::getAddress() const |
@@ -448,3 +450,17 @@ Bu::TcpSocket::operator int() const | |||
448 | return nTcpSocket; | 450 | return nTcpSocket; |
449 | } | 451 | } |
450 | 452 | ||
453 | Bu::size Bu::TcpSocket::getSize() const | ||
454 | { | ||
455 | throw UnsupportedException(); | ||
456 | } | ||
457 | |||
458 | Bu::size Bu::TcpSocket::getBlockSize() const | ||
459 | { | ||
460 | |||
461 | } | ||
462 | |||
463 | Bu::FString Bu::TcpSocket::getLocation() const | ||
464 | { | ||
465 | } | ||
466 | |||