OpenTTD Source  12.0-beta2
NetworkDirectConnecter Class Reference

Connect to a game server by IP:port. More...

Inheritance diagram for NetworkDirectConnecter:
TCPConnecter

Public Member Functions

 NetworkDirectConnecter (const std::string &hostname, uint16 port, const std::string &token, uint8 tracking_number)
 Try to establish a direct (hostname:port based) connection. More...
 
void OnFailure () override
 Callback for when the connection attempt failed.
 
void OnConnect (SOCKET s) override
 Callback when the connection succeeded. More...
 
- Public Member Functions inherited from TCPConnecter
 TCPConnecter (const std::string &connection_string, uint16 default_port, NetworkAddress bind_address={}, int family=AF_UNSPEC)
 Create a new connecter for the given address. More...
 
void Kill ()
 Kill this connecter. More...
 

Private Attributes

std::string token
 Token of this connection.
 
uint8 tracking_number
 Tracking number of this connection.
 

Additional Inherited Members

- Static Public Member Functions inherited from TCPConnecter
static void CheckCallbacks ()
 Check whether we need to call the callback, i.e. More...
 
static void KillAll ()
 Kill all connection attempts.
 

Detailed Description

Connect to a game server by IP:port.

Definition at line 35 of file network_coordinator.cpp.

Constructor & Destructor Documentation

◆ NetworkDirectConnecter()

NetworkDirectConnecter::NetworkDirectConnecter ( const std::string &  hostname,
uint16  port,
const std::string &  token,
uint8  tracking_number 
)
inline

Try to establish a direct (hostname:port based) connection.

Parameters
hostnameThe hostname of the server.
portThe port of the server.
tokenThe token as given by the Game Coordinator to track this connection attempt.
tracking_numberThe tracking number as given by the Game Coordinator to track this connection attempt.

Definition at line 48 of file network_coordinator.cpp.

Member Function Documentation

◆ OnConnect()

void NetworkDirectConnecter::OnConnect ( SOCKET  s)
inlineoverridevirtual

Callback when the connection succeeded.

Parameters
sthe socket that we opened

Reimplemented from TCPConnecter.

Definition at line 55 of file network_coordinator.cpp.

References _network_coordinator_client, ClientNetworkCoordinatorSocketHandler::ConnectSuccess(), and NetworkAddress::GetPeerAddress().


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