summaryrefslogtreecommitdiff
path: root/src/serversocket.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/serversocket.h')
-rw-r--r--src/serversocket.h64
1 files changed, 0 insertions, 64 deletions
diff --git a/src/serversocket.h b/src/serversocket.h
deleted file mode 100644
index ee357a4..0000000
--- a/src/serversocket.h
+++ /dev/null
@@ -1,64 +0,0 @@
1/*
2 * Copyright (C) 2007-2010 Xagasoft, All rights reserved.
3 *
4 * This file is part of the libbu++ library and is released under the
5 * terms of the license contained in the file LICENSE.
6 */
7
8#ifndef BU_SERVER_SOCKET_H
9#define BU_SERVER_SOCKET_H
10
11#include <stdint.h>
12#include "bu/fstring.h"
13#include "bu/exceptionbase.h"
14
15#ifdef WIN32
16 #include <Winsock2.h>
17#else
18 #include <sys/select.h>
19#endif
20
21namespace Bu
22{
23 subExceptionDecl( ServerSocketException );
24
25 /**
26 * A single tcp/ip server socket. When created the server socket will bind
27 * to the specified interface and port, and immediately begin listening for
28 * connections. When connections come in they are pooled by the networking
29 * drivers in the kernel until they are accepted, this means that failure
30 * to keep space in the connection pool will result in connection refusals.
31 *
32 * Although the accept function returns an integral file descriptor, it is
33 * designed to be used with the Socket class.
34 *
35 *@ingroup Serving
36 */
37 class ServerSocket
38 {
39 public:
40 ServerSocket( int nPort, int nPoolSize=40 );
41 ServerSocket( const FString &sAddr, int nPort, int nPoolSize=40 );
42 ServerSocket( int nSocket, bool bInit, int nPoolSize=40 );
43 ServerSocket( const ServerSocket &rSrc );
44 virtual ~ServerSocket();
45
46 int accept( int nTimeoutSec=0, int nTimeoutUSec=0 );
47 int getSocket();
48 int getPort();
49
50 private:
51 void startServer( struct sockaddr_in &name, int nPoolSize );
52 void initServer( struct sockaddr_in &name, int nPoolSize );
53
54 fd_set fdActive;
55#ifdef WIN32
56 unsigned int nServer;
57#else
58 int nServer;
59#endif
60 int nPort;
61 };
62}
63
64#endif