libUTL++
TCPserverSocket.h
1 #pragma once
2 
4 
5 #include <libutl/FDstream.h>
6 #include <libutl/ServerSocket.h>
7 
9 
10 UTL_NS_BEGIN;
11 
13 
21 
24 {
28 
29 public:
36  TCPserverSocket(const InetHostAddress* hostAddr, uint16_t port, int backlog = -1);
37 
38  virtual FDstream* makeSocket() const;
39 
46  virtual bool accept(FDstream* socket, InetHostAddress* clientAddr = nullptr);
47 
54  void open(const InetHostAddress* hostAddr, uint16_t port, int backlog = -1);
55 
56 private:
57  InetHostAddress _hostAddr;
58  uint16_t _port;
59 };
60 
62 
63 UTL_NS_END;
#define UTL_CLASS_DEFID
Default init() and deInit() (which are merely place-holders).
Definition: macros.h:532
#define UTL_CLASS_DECL(DC, BC)
Declaration of standard UTL++ functionality for a non-template class.
Definition: macros.h:688
Local host server socket.
Definition: ServerSocket.h:24
TCP server socket.
unsigned short uint16_t
Unsigned 16-bit integer.
Definition: types.h:101
#define UTL_CLASS_NO_COPY
Declare that a class cannot do copy().
Definition: macros.h:358
Stream with file descriptor.
Definition: FDstream.h:35
Internet host address.