OpenTTD Source: ServerNetworkUDPSocketHandler Class Reference

OpenTTD Source 12.2

Public Member Functions | Protected Member Functions
ServerNetworkUDPSocketHandler Class Reference

‍*** Communication with clients (we are server) ***‍/ More...

Inheritance diagram for ServerNetworkUDPSocketHandler:

## Public Member Functions
| ServerNetworkUDPSocketHandler (NetworkAddressList *addresses)
| Create the socket. More...
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 ()
| 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 Member Functions
void | Receive_CLIENT_FIND_SERVER (Packet *p, NetworkAddress *client_addr) override
| Queries to the server for information about the game. More...
Protected Member Functions inherited from NetworkUDPSocketHandler
void | ReceiveInvalidPacket (PacketUDPType, NetworkAddress *client_addr)
| Helper for logging receiving invalid packets. More...
virtual void | Receive_SERVER_RESPONSE (Packet *p, NetworkAddress *client_addr)
| Response to a query letting the client know we are here. More...
void | HandleUDPPacket (Packet *p, NetworkAddress *client_addr)
| Handle an incoming packets by sending it to the correct function. More...

## Additional Inherited Members
Protected Attributes inherited from NetworkUDPSocketHandler
NetworkAddressList | bind
| The address to bind to.
SocketList | sockets
| The opened sockets.

## Detailed Description

‍*** Communication with clients (we are server) ***‍/

Helper class for handling all server side communication.

Definition at line 64 of file network_udp.cpp.

## Constructor & Destructor Documentation

## ◆ ServerNetworkUDPSocketHandler()

ServerNetworkUDPSocketHandler::ServerNetworkUDPSocketHandler | ( | NetworkAddressList * | addresses | ) |
| inline

Create the socket.

Parameters

  addresses | The addresses to bind on.

Definition at line 72 of file network_udp.cpp.

## Member Function Documentation

## ◆ Receive_CLIENT_FIND_SERVER()

void ServerNetworkUDPSocketHandler::Receive_CLIENT_FIND_SERVER | ( | Packet * | p,
|  | NetworkAddress * | client_addr
| ) |  |
| overrideprotectedvirtual

Queries to the server for information about the game.

Parameters

  p | The received packet.
  client_addr | The origin of the packet.

Reimplemented from NetworkUDPSocketHandler.

Definition at line 76 of file network_udp.cpp.

References Debug, NetworkAddress::GetHostname(), PACKET_UDP_SERVER_RESPONSE, and NetworkUDPSocketHandler::SendPacket().

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

- src/network/network_udp.cpp