diff options
author | Mike Buland <eichlan@xagasoft.com> | 2007-07-03 00:28:59 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2007-07-03 00:28:59 +0000 |
commit | ac517a2b7625e0aa0862679e961c6349f859ea3b (patch) | |
tree | e3e27a6b9bd5e2be6150088495c91fc91786ad9d /src/serversocket.h | |
parent | f8d4301e9fa4f3709258505941e37fab2eadadc6 (diff) | |
parent | bd865cee5f89116c1f054cd0e5c275e97c2d0a9b (diff) | |
download | libbu++-ac517a2b7625e0aa0862679e961c6349f859ea3b.tar.gz libbu++-ac517a2b7625e0aa0862679e961c6349f859ea3b.tar.bz2 libbu++-ac517a2b7625e0aa0862679e961c6349f859ea3b.tar.xz libbu++-ac517a2b7625e0aa0862679e961c6349f859ea3b.zip |
The reorg is being put in trunk, I think it's ready. Now we just get to find
out how many applications won't work anymore :)
Diffstat (limited to '')
-rw-r--r-- | src/serversocket.h | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/serversocket.h b/src/serversocket.h new file mode 100644 index 0000000..b4ee247 --- /dev/null +++ b/src/serversocket.h | |||
@@ -0,0 +1,39 @@ | |||
1 | #ifndef BU_SERVER_SOCKET_H | ||
2 | #define BU_SERVER_SOCKET_H | ||
3 | |||
4 | #include <stdint.h> | ||
5 | #include "bu/fstring.h" | ||
6 | |||
7 | namespace Bu | ||
8 | { | ||
9 | /** | ||
10 | * A single tcp/ip server socket. When created the server socket will bind | ||
11 | * to the specified interface and port, and immediately begin listening for | ||
12 | * connections. When connections come in they are pooled by the networking | ||
13 | * drivers in the kernel until they are accepted, this means that failure | ||
14 | * to keep space in the connection pool will result in connection refusals. | ||
15 | * | ||
16 | * Although the accept function returns an integral file descriptor, it is | ||
17 | * designed to be used with the Socket class. | ||
18 | */ | ||
19 | class ServerSocket | ||
20 | { | ||
21 | public: | ||
22 | ServerSocket( int nPort, int nPoolSize=40 ); | ||
23 | ServerSocket( const FString &sAddr, int nPort, int nPoolSize=40 ); | ||
24 | virtual ~ServerSocket(); | ||
25 | |||
26 | int accept( int nTimeoutSec=0, int nTimeoutUSec=0 ); | ||
27 | int getSocket(); | ||
28 | int getPort(); | ||
29 | |||
30 | private: | ||
31 | void startServer( struct sockaddr_in &name, int nPoolSize ); | ||
32 | |||
33 | fd_set fdActive; | ||
34 | int nServer; | ||
35 | int nPort; | ||
36 | }; | ||
37 | } | ||
38 | |||
39 | #endif | ||