aboutsummaryrefslogtreecommitdiff
path: root/src/stable/serversockettcp.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/serversockettcp.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 '')
-rw-r--r--src/stable/serversockettcp.h (renamed from src/stable/tcpserversocket.h)28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/stable/tcpserversocket.h b/src/stable/serversockettcp.h
index d15d7bd..8e43c76 100644
--- a/src/stable/tcpserversocket.h
+++ b/src/stable/serversockettcp.h
@@ -5,12 +5,13 @@
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_SERVER_SOCKET_H 8#ifndef BU_SERVER_SOCKET_TCP_H
9#define BU_TCP_SERVER_SOCKET_H 9#define BU_SERVER_SOCKET_TCP_H
10 10
11#include <stdint.h> 11#include <stdint.h>
12#include "bu/string.h" 12#include "bu/string.h"
13#include "bu/exceptionbase.h" 13#include "bu/exceptionbase.h"
14#include "bu/serversocket.h"
14 15
15#ifdef WIN32 16#ifdef WIN32
16 #include <Winsock2.h> 17 #include <Winsock2.h>
@@ -20,7 +21,7 @@
20 21
21namespace Bu 22namespace Bu
22{ 23{
23 subExceptionDecl( TcpServerSocketException ); 24 subExceptionDecl( ServerSocketTcpException );
24 25
25 /** 26 /**
26 * A single tcp/ip server socket. When created the server socket will bind 27 * A single tcp/ip server socket. When created the server socket will bind
@@ -34,7 +35,7 @@ namespace Bu
34 * 35 *
35 *@ingroup Serving 36 *@ingroup Serving
36 */ 37 */
37 class TcpServerSocket 38 class ServerSocketTcp : public ServerSocket
38 { 39 {
39 public: 40 public:
40#ifdef WIN32 41#ifdef WIN32
@@ -42,23 +43,22 @@ namespace Bu
42#else 43#else
43 typedef int socket_t; 44 typedef int socket_t;
44#endif 45#endif
45 TcpServerSocket( int nPort, int nPoolSize=40 ); 46 ServerSocketTcp( int iPort, int nPoolSize=40 );
46 TcpServerSocket( const String &sAddr, int nPort, int nPoolSize=40 ); 47 ServerSocketTcp( const String &sAddr, int iPort, int nPoolSize=40 );
47 TcpServerSocket( socket_t nSocket, bool bInit, int nPoolSize=40 ); 48 ServerSocketTcp( socket_t nSocket, bool bInit, int nPoolSize=40 );
48 TcpServerSocket( const TcpServerSocket &rSrc ); 49 ServerSocketTcp( const ServerSocketTcp &rSrc );
49 virtual ~TcpServerSocket(); 50 virtual ~ServerSocketTcp();
50 51
51 int accept( int nTimeoutSec=0, int nTimeoutUSec=0 ); 52 virtual Bu::Socket *accept( int nTimeoutSec=0, int nTimeoutUSec=0 );
52 int getSocket(); 53 virtual bool getFd( int &rFdOut ) const;
53 int getPort();
54 54
55 private: 55 private:
56 void startServer( struct sockaddr_in &name, int nPoolSize ); 56 void startServer( struct sockaddr_in &name, int nPoolSize );
57 void initServer( struct sockaddr_in &name, int nPoolSize ); 57 void initServer( struct sockaddr_in &name, int nPoolSize );
58 58
59 fd_set fdActive; 59 fd_set fdActive;
60 socket_t nServer; 60 socket_t iSocket;
61 int nPort; 61 int iPort;
62 }; 62 };
63} 63}
64 64