diff options
Diffstat (limited to '')
-rw-r--r-- | src/stable/sockettcp.h (renamed from src/stable/tcpsocket.h) | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/src/stable/tcpsocket.h b/src/stable/sockettcp.h index 69cc4fd..3fc14ef 100644 --- a/src/stable/tcpsocket.h +++ b/src/stable/sockettcp.h | |||
@@ -5,19 +5,19 @@ | |||
5 | * terms of the license contained in the file LICENSE. | 5 | * terms of the license contained in the file LICENSE. |
6 | */ | 6 | */ |
7 | 7 | ||
8 | #ifndef BU_TCP_SOCKET_H | 8 | #ifndef BU_SOCKET_TCP_H |
9 | #define BU_TCP_SOCKET_H | 9 | #define BU_SOCKET_TCP_H |
10 | 10 | ||
11 | #include <stdint.h> | 11 | #include <stdint.h> |
12 | 12 | ||
13 | #include "bu/config.h" | 13 | #include "bu/config.h" |
14 | #include "bu/stream.h" | 14 | #include "bu/socket.h" |
15 | #include "bu/string.h" | 15 | #include "bu/string.h" |
16 | #include "bu/exceptionbase.h" | 16 | #include "bu/exceptionbase.h" |
17 | 17 | ||
18 | namespace Bu | 18 | namespace Bu |
19 | { | 19 | { |
20 | subExceptionDeclBegin( TcpSocketException ); | 20 | subExceptionDeclBegin( SocketTcpException ); |
21 | enum { | 21 | enum { |
22 | cRead, | 22 | cRead, |
23 | cWrite, | 23 | cWrite, |
@@ -41,23 +41,23 @@ namespace Bu | |||
41 | * Please note that there is a condition that will occur eventually (at | 41 | * Please note that there is a condition that will occur eventually (at |
42 | * least on *nix systems) that will trigger a SIGPIPE condition. This | 42 | * least on *nix systems) that will trigger a SIGPIPE condition. This |
43 | * will terminate your program immediately unless handled properly. Most | 43 | * will terminate your program immediately unless handled properly. Most |
44 | * people doing any connections with TcpSocket will want to put this in | 44 | * people doing any connections with SocketTcp will want to put this in |
45 | * their program somewhere before they use it: | 45 | * their program somewhere before they use it: |
46 | *@code | 46 | *@code |
47 | #include <signal.h> | 47 | #include <signal.h> |
48 | ... | 48 | ... |
49 | ... | 49 | ... |
50 | ... | 50 | ... |
51 | sigset( SIGPIPE, SIG_IGN ); // do this before you use a Bu::TcpSocket | 51 | sigset( SIGPIPE, SIG_IGN ); // do this before you use a Bu::SocketTcp |
52 | @endcode | 52 | @endcode |
53 | * When this is done, Bu::TcpSocket will simply throw a broken pipe | 53 | * When this is done, Bu::SocketTcp will simply throw a broken pipe |
54 | * exception just like every other error condition, allowing your program | 54 | * exception just like every other error condition, allowing your program |
55 | * to handle it sanely. | 55 | * to handle it sanely. |
56 | * | 56 | * |
57 | *@ingroup Serving | 57 | *@ingroup Serving |
58 | *@ingroup Streams | 58 | *@ingroup Streams |
59 | */ | 59 | */ |
60 | class TcpSocket : public Stream | 60 | class SocketTcp : public Socket |
61 | { | 61 | { |
62 | public: | 62 | public: |
63 | #ifdef WIN32 | 63 | #ifdef WIN32 |
@@ -66,10 +66,10 @@ namespace Bu | |||
66 | typedef int handle; | 66 | typedef int handle; |
67 | #endif | 67 | #endif |
68 | 68 | ||
69 | TcpSocket( handle nTcpSocket ); | 69 | SocketTcp( handle nSocketTcp ); |
70 | TcpSocket( const String &sAddr, int nPort, int nTimeout=30, | 70 | SocketTcp( const String &sAddr, int nPort, int nTimeout=30, |
71 | bool bBlocking=true ); | 71 | bool bBlocking=true ); |
72 | virtual ~TcpSocket(); | 72 | virtual ~SocketTcp(); |
73 | 73 | ||
74 | virtual void close(); | 74 | virtual void close(); |
75 | virtual size read( void *pBuf, size nBytes ); | 75 | virtual size read( void *pBuf, size nBytes ); |
@@ -111,10 +111,12 @@ namespace Bu | |||
111 | virtual size getBlockSize() const; | 111 | virtual size getBlockSize() const; |
112 | virtual Bu::String getLocation() const; | 112 | virtual Bu::String getLocation() const; |
113 | 113 | ||
114 | virtual bool getFd( int &rFdOut ) const; | ||
115 | |||
114 | private: | 116 | private: |
115 | void setAddress(); | 117 | void setAddress(); |
116 | 118 | ||
117 | handle nTcpSocket; | 119 | handle nSocketTcp; |
118 | 120 | ||
119 | bool bActive; | 121 | bool bActive; |
120 | bool bBlocking; | 122 | bool bBlocking; |