tcp_listen.h
1 
2 #pragma once
3 
4 #include "network_condition_variable.h"
5 #include <memory>
6 #include <vector>
7 
8 namespace uicore
9 {
10  class SocketName;
11  class TCPConnection;
12 
14  class TCPListen : public NetworkEvent
15  {
16  public:
18  static std::shared_ptr<TCPListen> listen(const SocketName &endpoint, int backlog = 5, bool reuse_address = true);
19 
21  virtual void close() = 0;
22 
26  virtual std::shared_ptr<TCPConnection> accept(SocketName &end_point) = 0;
27  };
28 
29  typedef std::shared_ptr<TCPListen> TCPListenPtr;
30 }
Socket name; container class for an IP address and port.
Definition: socket_name.h:39
Base class for all classes that generate network events.
Definition: network_condition_variable.h:14
virtual std::shared_ptr< TCPConnection > accept(SocketName &end_point)=0
Accept an incoming connection.
virtual void close()=0
Stops listening for incoming messages and closes the socket.
static std::shared_ptr< TCPListen > listen(const SocketName &endpoint, int backlog=5, bool reuse_address=true)
Create a listening socket for the specified end point.
Listens for incoming TCP/IP socket connections.
Definition: tcp_listen.h:14
std::shared_ptr< TCPListen > TCPListenPtr
Definition: tcp_listen.h:29
Definition: Application/application.h:35