|
libclod
C library for interacting with NBTs, region files, LOD data and other things.
|
#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. | |
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.
| clod_stream clod_socket::stream |