Functions | |
int | UDP_AddrCompare (netadr_t *addr1, netadr_t *addr2) |
Compare two network addresses. More... | |
const char * | UDP_AddrToString (netadr_t *addr) |
Convert an address to a string. More... | |
int | UDP_Broadcast (int socket, byte *buf, int len) |
Broadcast a packet via the specified socket. More... | |
int | UDP_CheckNewConnections (void) |
Check for incoming packets on the accept socket. More... | |
int | UDP_CloseSocket (int socket) |
Close a socket. More... | |
int | UDP_Connect (int socket, netadr_t *addr) |
Does very little. More... | |
int | UDP_GetAddrFromName (const char *name, netadr_t *addr) |
Convert a human readable address to a quake address. More... | |
int | UDP_GetNameFromAddr (netadr_t *addr, char *name) |
Convert an address to a hostname. More... | |
int | UDP_GetSocketAddr (int socket, netadr_t *addr) |
Retrieve the address to which the socket is bound. More... | |
int | UDP_GetSocketPort (netadr_t *addr) |
Get the port number from the socket address. More... | |
int | UDP_Init (void) |
Initialize the UDP network interface. More... | |
void | UDP_Listen (qboolean state) |
Open or close the accept socket. More... | |
int | UDP_OpenSocket (int port) |
Open a single socket on the specified port. More... | |
int | UDP_Read (int socket, byte *buf, int len, netadr_t *addr) |
Read a packet from the specified socket. More... | |
int | UDP_SetSocketPort (netadr_t *addr, int port) |
Set the port number of the socket address. More... | |
void | UDP_Shutdown (void) |
Shutdown the UDP network interface. More... | |
int | UDP_Write (int socket, byte *buf, int len, netadr_t *addr) |
Send a packet via the specified socket to the specified address. More... | |
Compare two network addresses.
Compare the port number too.
addr1 | The first address to compare. |
addr2 | The second address to compare. |
Convert an address to a string.
Include the port number in the string.
addr | The address to convert. |
Broadcast a packet via the specified socket.
socket | The socket via which the packet will be broadcast. |
buf | The packet data to be sent. |
len | The number of bytes in the packet. |
int UDP_CheckNewConnections | ( | void | ) |
Check for incoming packets on the accept socket.
Checks if any packets are available on net_acceptsocket.
Close a socket.
socket | The socket to close. |
Does very little.
socket | The socket on which to do very little. |
addr | The address to which very little will be done. |
Convert a human readable address to a quake address.
Accepts both host names (full or partial) and numeric form.
The port address can be specified when using a numeric address.
Numeric addresses can be partial: unspecified portions are filled out using the network address of the socket.
name | The human readable address to be converted. |
addr | The resulting address of the conversion. |
Convert an address to a hostname.
[in] | addr | The address to covert. |
[out] | name | Output buffer for the hostname. |
Retrieve the address to which the socket is bound.
socket | The socket for which the address will be retrieved. | |
[out] | addr | The address to which the socket is bound. |
Get the port number from the socket address.
addr | The socket address from which to retrieve the port number. |
int UDP_Init | ( | void | ) |
Initialize the UDP network interface.
Opens a single control socket.
void UDP_Listen | ( | qboolean | state | ) |
Open or close the accept socket.
Sets net_acceptsocket to the socket number or -1. The accept socket is stored in net_hostport.
state | True to open the socket, false to close it. |
Open a single socket on the specified port.
If port
is 0, then use the operating system default.
port | The port on which to open the socket. |
Read a packet from the specified socket.
socket | The socket from which the packet will be read. | |
buf | The buffer into which the packet will be read. | |
len | The maximum number of bytes to read. | |
[out] | addr | The address from which the packet originated. |
Set the port number of the socket address.
addr | The socket address which to will have its port number set. |
port | The port number to which the socket address will be set. |
void UDP_Shutdown | ( | void | ) |
Shutdown the UDP network interface.
Send a packet via the specified socket to the specified address.
socket | The socket via which the packet will be sent. |
buf | The packet data to be sent. |
len | The number of bytes in the packet. |
addr | The addres to which the packet will be sent. |