OpenTTD Source  20241108-master-g80f628063a
ClientNetworkUDPSocketHandler Class Reference

‍*** Communication with servers (we are client) ***‍/ More...

Inheritance diagram for ClientNetworkUDPSocketHandler:
NetworkUDPSocketHandler NetworkSocketHandler

Protected Member Functions

void Receive_SERVER_RESPONSE (Packet &p, NetworkAddress &client_addr) override
 Response to a query letting the client know we are here. More...
 
- Protected Member Functions inherited from NetworkUDPSocketHandler
void ReceiveInvalidPacket (PacketUDPType, NetworkAddress &client_addr)
 Helper for logging receiving invalid packets. More...
 
virtual void Receive_CLIENT_FIND_SERVER (Packet &p, NetworkAddress &client_addr)
 Queries to the server for information about the game. More...
 
void HandleUDPPacket (Packet &p, NetworkAddress &client_addr)
 Handle an incoming packets by sending it to the correct function. More...
 

Additional Inherited Members

- Public Member Functions inherited from NetworkUDPSocketHandler
 NetworkUDPSocketHandler (NetworkAddressList *bind=nullptr)
 Create an UDP socket but don't listen yet. More...
 
virtual ~NetworkUDPSocketHandler ()
 On destructing of this class, the socket needs to be closed.
 
bool Listen ()
 Start listening on the given host and port. More...
 
void CloseSocket ()
 Close the actual UDP socket.
 
void SendPacket (Packet &p, NetworkAddress &recv, bool all=false, bool broadcast=false)
 Send a packet over UDP. More...
 
void ReceivePackets ()
 Receive a packet at UDP level.
 
- Public Member Functions inherited from NetworkSocketHandler
 NetworkSocketHandler ()
 Create a new unbound socket.
 
virtual ~NetworkSocketHandler ()=default
 Close the socket when destructing the socket handler.
 
void MarkClosed ()
 Mark the connection as closed. More...
 
bool HasClientQuit () const
 Whether the current client connected to the socket has quit. More...
 
void Reopen ()
 Reopen the socket so we can send/receive stuff again.
 
- Protected Attributes inherited from NetworkUDPSocketHandler
NetworkAddressList bind
 The address to bind to.
 
SocketList sockets
 The opened sockets.
 
- Protected Attributes inherited from NetworkSocketHandler
std::unique_ptr< class NetworkEncryptionHandlerreceive_encryption_handler
 The handler for decrypting received packets.
 
std::unique_ptr< class NetworkEncryptionHandlersend_encryption_handler
 The handler for encrypting sent packets.
 

Detailed Description

‍*** Communication with servers (we are client) ***‍/

Helper class for handling all client side communication.

Definition at line 87 of file network_udp.cpp.

Member Function Documentation

◆ Receive_SERVER_RESPONSE()

void ClientNetworkUDPSocketHandler::Receive_SERVER_RESPONSE ( Packet p,
NetworkAddress client_addr 
)
overrideprotectedvirtual

Response to a query letting the client know we are here.

Parameters
pThe received packet.
client_addrThe origin of the packet.

Reimplemented from NetworkUDPSocketHandler.

Definition at line 94 of file network_udp.cpp.

References Debug, NetworkAddress::GetAddressAsString(), and NetworkAddServer().


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