libclod
C library for interacting with NBTs, region files, LOD data and other things.
Loading...
Searching...
No Matches
clod_socket Struct Reference

#include <net.h>

Public Attributes

clod_stream stream
unsigned char local_addr [16]
 Local IP address.
unsigned short local_port
 Local port number.
unsigned char remote_addr [16]
 Remote IP address.
unsigned short remote_port
 Remote port number.

Detailed Description

Stream of data over the network.

For UDP, the remote_addr field is updated upon each return from stream->read() with the address of the system which sent the packet. Calls to stream->write() read this field to discern the IP address to send the packet to. This intentionally creates a happy coincidence where calls to stream->write() reply to the address which sent the most recently read data. To send to a specific address, the remote_addr is set manually.

For TCP, the stream does not handle multiple remote addresses, and instead persists for the duration of the connection. Unlike UDP sockets, remote_addr should not be changed.

If the buffer passed to stream->read() is not large enough, subsequent calls will always finish reading the entire packet before reading the next.

Definition at line 36 of file net.h.

Member Data Documentation

◆ stream

clod_stream clod_socket::stream

Definition at line 37 of file net.h.

◆ local_addr

unsigned char clod_socket::local_addr[16]

Local IP address.

Definition at line 39 of file net.h.

◆ local_port

unsigned short clod_socket::local_port

Local port number.

Definition at line 41 of file net.h.

◆ remote_addr

unsigned char clod_socket::remote_addr[16]

Remote IP address.

Definition at line 43 of file net.h.

◆ remote_port

unsigned short clod_socket::remote_port

Remote port number.

Definition at line 45 of file net.h.


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