OpenTTD Source  1.11.2
TCPListenHandler< Tsocket, Tfull_packet, Tban_packet > Class Template Reference

Template for TCP listeners. More...

#include <tcp_listen.h>

Static Public Member Functions

static void AcceptClient (SOCKET ls)
 Accepts clients from the sockets. More...
 
static bool Receive ()
 Handle the receiving of packets. More...
 
static bool Listen (uint16 port)
 Listen on a particular port. More...
 
static void CloseListeners ()
 Close the sockets we're listening on.
 

Static Private Attributes

static SocketList sockets
 List of sockets we listen on.
 

Detailed Description

template<class Tsocket, PacketType Tfull_packet, PacketType Tban_packet>
class TCPListenHandler< Tsocket, Tfull_packet, Tban_packet >

Template for TCP listeners.

Parameters
TsocketThe class we create sockets for.
Tfull_packetThe packet type to return when we don't allow more sockets.
Tban_packetThe packet type to return when the client is banned.

Definition at line 28 of file tcp_listen.h.

Member Function Documentation

◆ AcceptClient()

template<class Tsocket , PacketType Tfull_packet, PacketType Tban_packet>
static void TCPListenHandler< Tsocket, Tfull_packet, Tban_packet >::AcceptClient ( SOCKET  ls)
inlinestatic

Accepts clients from the sockets.

Parameters
lsSocket to accept clients from.

Definition at line 37 of file tcp_listen.h.

Referenced by TCPListenHandler< ServerNetworkGameSocketHandler, PACKET_SERVER_FULL, PACKET_SERVER_BANNED >::Receive().

◆ Listen()

template<class Tsocket , PacketType Tfull_packet, PacketType Tban_packet>
static bool TCPListenHandler< Tsocket, Tfull_packet, Tban_packet >::Listen ( uint16  port)
inlinestatic

Listen on a particular port.

Parameters
portThe port to listen on.
Returns
true if listening succeeded.

Definition at line 141 of file tcp_listen.h.

◆ Receive()

template<class Tsocket , PacketType Tfull_packet, PacketType Tban_packet>
static bool TCPListenHandler< Tsocket, Tfull_packet, Tban_packet >::Receive ( )
inlinestatic

Handle the receiving of packets.

Returns
true if everything went okay.

Definition at line 99 of file tcp_listen.h.


The documentation for this class was generated from the following file: