aboutsummaryrefslogtreecommitdiff
path: root/src/stable/tcpserversocket.h
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2023-07-28 21:18:56 -0700
committerMike Buland <eichlan@xagasoft.com>2023-07-28 21:18:56 -0700
commit915005e218b5d00939b548de65ce6354f7acb487 (patch)
tree2f624a37f86f97cfd61c1995df7e4368b462bcac /src/stable/tcpserversocket.h
parente43a2cac32cb773994b11a3d964ec4acc372d273 (diff)
downloadlibbu++-915005e218b5d00939b548de65ce6354f7acb487.tar.gz
libbu++-915005e218b5d00939b548de65ce6354f7acb487.tar.bz2
libbu++-915005e218b5d00939b548de65ce6354f7acb487.tar.xz
libbu++-915005e218b5d00939b548de65ce6354f7acb487.zip
Completely redesigned Server and Client.
Like, seriously, they're almost completely different.
Diffstat (limited to 'src/stable/tcpserversocket.h')
-rw-r--r--src/stable/tcpserversocket.h65
1 files changed, 0 insertions, 65 deletions
diff --git a/src/stable/tcpserversocket.h b/src/stable/tcpserversocket.h
deleted file mode 100644
index d15d7bd..0000000
--- a/src/stable/tcpserversocket.h
+++ /dev/null
@@ -1,65 +0,0 @@
1/*
2 * Copyright (C) 2007-2019 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_TCP_SERVER_SOCKET_H
9#define BU_TCP_SERVER_SOCKET_H
10
11#include <stdint.h>
12#include "bu/string.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( TcpServerSocketException );
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 TcpServerSocket
38 {
39 public:
40#ifdef WIN32
41 typedef unsigned int socket_t;
42#else
43 typedef int socket_t;
44#endif
45 TcpServerSocket( int nPort, int nPoolSize=40 );
46 TcpServerSocket( const String &sAddr, int nPort, int nPoolSize=40 );
47 TcpServerSocket( socket_t nSocket, bool bInit, int nPoolSize=40 );
48 TcpServerSocket( const TcpServerSocket &rSrc );
49 virtual ~TcpServerSocket();
50
51 int accept( int nTimeoutSec=0, int nTimeoutUSec=0 );
52 int getSocket();
53 int getPort();
54
55 private:
56 void startServer( struct sockaddr_in &name, int nPoolSize );
57 void initServer( struct sockaddr_in &name, int nPoolSize );
58
59 fd_set fdActive;
60 socket_t nServer;
61 int nPort;
62 };
63}
64
65#endif