OpenTTD Source  20241120-master-g6d3adc6169
network_udp.cpp File Reference

This file handles the UDP related communication. More...

#include "../stdafx.h"
#include "../timer/timer_game_calendar.h"
#include "../map_func.h"
#include "../debug.h"
#include "core/network_game_info.h"
#include "network_gamelist.h"
#include "network_internal.h"
#include "network_udp.h"
#include "network.h"
#include "../core/endian_func.hpp"
#include "../company_base.h"
#include "../rev.h"
#include "../newgrf_text.h"
#include "../strings_func.h"
#include "table/strings.h"
#include "core/udp.h"
#include "../safeguards.h"

Go to the source code of this file.

Data Structures

struct  UDPSocket
 Some information about a socket, which exists before the actual socket has been created to provide locking and the likes. More...
 
class  ServerNetworkUDPSocketHandler
 ‍*** Communication with clients (we are server) ***‍/ More...
 
class  ClientNetworkUDPSocketHandler
 ‍*** Communication with servers (we are client) ***‍/ More...
 

Functions

static void NetworkUDPBroadCast (NetworkUDPSocketHandler *socket)
 Broadcast to all ips.
 
void NetworkUDPSearchGame ()
 Find all servers.
 
void NetworkUDPInitialize ()
 Initialize the whole UDP bit.
 
void NetworkUDPServerListen ()
 Start the listening of the UDP server component.
 
void NetworkUDPClose ()
 Close all UDP related stuff.
 
void NetworkBackgroundUDPLoop ()
 Receive the UDP packets.
 

Variables

static bool _network_udp_server
 Is the UDP server started?
 
static uint16_t _network_udp_broadcast
 Timeout for the UDP broadcasts.
 
static UDPSocket _udp_client ("Client")
 udp client socket
 
static UDPSocket _udp_server ("Server")
 udp server socket
 

Detailed Description

This file handles the UDP related communication.

This is the GameServer <-> GameClient communication before the game is being joined.

Definition in file network_udp.cpp.