diff options
author | Mike Buland <eichlan@xagasoft.com> | 2011-07-25 17:25:28 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2011-07-25 17:25:28 +0000 |
commit | d3a6d910f96d1509b17165b635663b608681b89a (patch) | |
tree | 923b1e0f783d5b710f82664591812895cb9dbba3 /src/tcpsocket.cpp | |
parent | d0d86b9ae6a86fec59f69c76352c640e759bd4a1 (diff) | |
download | libbu++-d3a6d910f96d1509b17165b635663b608681b89a.tar.gz libbu++-d3a6d910f96d1509b17165b635663b608681b89a.tar.bz2 libbu++-d3a6d910f96d1509b17165b635663b608681b89a.tar.xz libbu++-d3a6d910f96d1509b17165b635663b608681b89a.zip |
In theory, after constructing a TcpSocket object, you can now take the
operating system socket handle away and use it yourself, after doing so, the
TcpSocket will not close the socket when it exits, or be able to effect it ever
again.
Diffstat (limited to 'src/tcpsocket.cpp')
-rw-r--r-- | src/tcpsocket.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/tcpsocket.cpp b/src/tcpsocket.cpp index 399ec44..b9b215c 100644 --- a/src/tcpsocket.cpp +++ b/src/tcpsocket.cpp | |||
@@ -31,7 +31,7 @@ | |||
31 | 31 | ||
32 | namespace Bu { subExceptionDef( TcpSocketException ) } | 32 | namespace Bu { subExceptionDef( TcpSocketException ) } |
33 | 33 | ||
34 | Bu::TcpSocket::TcpSocket( int nTcpSocket ) : | 34 | Bu::TcpSocket::TcpSocket( handle nTcpSocket ) : |
35 | nTcpSocket( nTcpSocket ), | 35 | nTcpSocket( nTcpSocket ), |
36 | bActive( true ), | 36 | bActive( true ), |
37 | bBlocking( true ) | 37 | bBlocking( true ) |
@@ -443,11 +443,24 @@ Bu::String Bu::TcpSocket::getAddress() const | |||
443 | return sAddress; | 443 | return sAddress; |
444 | } | 444 | } |
445 | 445 | ||
446 | Bu::TcpSocket::operator int() const | 446 | Bu::TcpSocket::operator Bu::TcpSocket::handle() const |
447 | { | 447 | { |
448 | return nTcpSocket; | 448 | return nTcpSocket; |
449 | } | 449 | } |
450 | 450 | ||
451 | Bu::TcpSocket::handle Bu::TcpSocket::getHandle() const | ||
452 | { | ||
453 | return nTcpSocket; | ||
454 | } | ||
455 | |||
456 | Bu::TcpSocket::handle Bu::TcpSocket::takeHandle() | ||
457 | { | ||
458 | handle nRet = nTcpSocket; | ||
459 | bActive = false; | ||
460 | nTcpSocket = 0; | ||
461 | return nRet; | ||
462 | } | ||
463 | |||
451 | Bu::size Bu::TcpSocket::getSize() const | 464 | Bu::size Bu::TcpSocket::getSize() const |
452 | { | 465 | { |
453 | throw UnsupportedException(); | 466 | throw UnsupportedException(); |