tcp_listen.h Source File - ClanLib SDK
Description: tcp_listen.h Source File

tcp_listen.h
1
2#pragma once
3
4#include "network_condition_variable.h"
5#include <memory>
6#include <vector>
7
8namespace clan
9{
10 class SocketName;
11 class TCPConnection;
12 class TCPSocket;
13
15 class TCPListen : public NetworkEvent
16 {
17 public:
19 TCPListen();
20
22 TCPListen(const SocketName &endpoint, int backlog = 5, bool reuse_address = true);
23
24 ~TCPListen();
25
27 bool is_null() const { return !impl; }
28
30 void close();
31
35 TCPConnection accept(SocketName &end_point);
36
37 protected:
38 SocketHandle *get_socket_handle() override;
39
40 private:
41 std::shared_ptr<TCPSocket> impl;
42 };
43}
clan::NetworkEvent
Base class for all classes that generate network events.
Definition network_condition_variable.h:15
clan::SocketName
Socket name; container class for an IP address and port.
Definition socket_name.h:45
clan::TCPConnection
TCP/IP socket connection.
Definition tcp_connection.h:18
clan::TCPListen::TCPListen
TCPListen(const SocketName &endpoint, int backlog=5, bool reuse_address=true)
Create a listening socket for the specified end point.
clan::TCPListen::accept
TCPConnection accept(SocketName &end_point)
Accept an incoming connection.
clan::TCPListen::TCPListen
TCPListen()
Create null object.
clan::TCPListen::~TCPListen
~TCPListen()
clan::TCPListen::is_null
bool is_null() const
Returns true if it is a null object.
Definition tcp_listen.h:27
clan::TCPListen::get_socket_handle
SocketHandle * get_socket_handle() override
clan::TCPListen::close
void close()
Stops listening for incoming messages and closes the socket.
clan
Definition clanapp.h:36