aboutsummaryrefslogtreecommitdiff
path: root/src/tcpsocket.h
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2010-10-16 03:02:11 +0000
committerMike Buland <eichlan@xagasoft.com>2010-10-16 03:02:11 +0000
commit9031e2af7dd4e65ec70890ee78a7cf600d1b2cc5 (patch)
tree17bc9d96b13d16d79385016c087321fc1267743f /src/tcpsocket.h
parent93c028162318a00b9bd03fc4a48383f830cc529d (diff)
downloadlibbu++-9031e2af7dd4e65ec70890ee78a7cf600d1b2cc5.tar.gz
libbu++-9031e2af7dd4e65ec70890ee78a7cf600d1b2cc5.tar.bz2
libbu++-9031e2af7dd4e65ec70890ee78a7cf600d1b2cc5.tar.xz
libbu++-9031e2af7dd4e65ec70890ee78a7cf600d1b2cc5.zip
Many, many changes. Documentation changes, renamed the socket class to
TcpSocket, fixed many other things, and finally removed ParamProc. Anything that needs it will now have to switch to OptParser.
Diffstat (limited to '')
-rw-r--r--src/tcpsocket.h (renamed from src/socket.h)31
1 files changed, 16 insertions, 15 deletions
diff --git a/src/socket.h b/src/tcpsocket.h
index c8f78f0..3361e84 100644
--- a/src/socket.h
+++ b/src/tcpsocket.h
@@ -5,8 +5,8 @@
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_SOCKET_H 8#ifndef BU_TCP_SOCKET_H
9#define BU_SOCKET_H 9#define BU_TCP_SOCKET_H
10 10
11#include <stdint.h> 11#include <stdint.h>
12 12
@@ -16,7 +16,7 @@
16 16
17namespace Bu 17namespace Bu
18{ 18{
19 subExceptionDeclBegin( SocketException ); 19 subExceptionDeclBegin( TcpSocketException );
20 enum { 20 enum {
21 cRead, 21 cRead,
22 cWrite, 22 cWrite,
@@ -40,28 +40,29 @@ namespace Bu
40 * Please note that there is a condition that will occur eventually (at 40 * Please note that there is a condition that will occur eventually (at
41 * least on *nix systems) that will trigger a SIGPIPE condition. This 41 * least on *nix systems) that will trigger a SIGPIPE condition. This
42 * will terminate your program immediately unless handled properly. Most 42 * will terminate your program immediately unless handled properly. Most
43 * people doing any connections with Socket will want to put this in their 43 * people doing any connections with TcpSocket will want to put this in
44 * program somewhere before they use it: 44 * their program somewhere before they use it:
45 *@code 45 *@code
46 #include <signal.h> 46 #include <signal.h>
47 ... 47 ...
48 ... 48 ...
49 ... 49 ...
50 sigset( SIGPIPE, SIG_IGN ); // do this before you use a Bu::Socket 50 sigset( SIGPIPE, SIG_IGN ); // do this before you use a Bu::TcpSocket
51 @endcode 51 @endcode
52 * When this is done, Bu::Socket will simply throw a broken pipe exception 52 * When this is done, Bu::TcpSocket will simply throw a broken pipe
53 * just like every other error condition, allowing your program to handle 53 * exception just like every other error condition, allowing your program
54 * it sanely. 54 * to handle it sanely.
55 * 55 *
56 *@ingroup Serving 56 *@ingroup Serving
57 *@ingroup Streams 57 *@ingroup Streams
58 */ 58 */
59 class Socket : public Stream 59 class TcpSocket : public Stream
60 { 60 {
61 public: 61 public:
62 Socket( int nSocket ); 62 TcpSocket( int nTcpSocket );
63 Socket( const FString &sAddr, int nPort, int nTimeout=30 ); 63 TcpSocket( const FString &sAddr, int nPort, int nTimeout=30,
64 virtual ~Socket(); 64 bool bBlocking=true );
65 virtual ~TcpSocket();
65 66
66 virtual void close(); 67 virtual void close();
67 //virtual void read(); 68 //virtual void read();
@@ -101,9 +102,9 @@ namespace Bu
101 void setAddress(); 102 void setAddress();
102 103
103#ifdef WIN32 104#ifdef WIN32
104 unsigned int nSocket; 105 unsigned int nTcpSocket;
105#else 106#else
106 int nSocket; 107 int nTcpSocket;
107#endif 108#endif
108 bool bActive; 109 bool bActive;
109 bool bBlocking; 110 bool bBlocking;