Nuclide
Software Development Kit for id Tech
|
TCP/IP Networking API. More...
Classes | |
struct | tcpinfo_t |
Macros | |
#define | TCP_BUFFER_LENGTH 32 |
Enumerations | |
enum | tcpstate_t { STATE_DISCONNECTED , STATE_CONNECTING , STATE_CONNECTED } |
State of a TCP connection. More... | |
Functions | |
int | TCP_Connect (tcpinfo_t *in, string path) |
Open a TCP socket connection. More... | |
void | TCP_Disconnect (tcpinfo_t *in) |
Closes a TCP socket connection. More... | |
int | TCP_Send (tcpinfo_t *in, string msg) |
Send a string buffer to a specified TCP connection. More... | |
string | TCP_Receive (tcpinfo_t *in) |
Receive the latest message from a TCP connection. More... | |
void | TCP_Frame (tcpinfo_t *in) |
You want to run this every frame. More... | |
tcpstate_t | TCP_GetState (tcpinfo_t *in) |
Returns the tcpstate_t of a connection. More... | |
TCP/IP Networking API.
The TCP API manages the sending/receiving of data over TCP sockets.
First, establish a connection with TCP_Connect(), which will return a file descriptior. If TCP_Connect returns a value below 0, no connection is possible. You can send data through TCP_Send() once TCP_GetState returns STATE_CONNECTED.
You need to run TCP_Frame() on your tcpinfo_t struct every frame in order to listen to network activity.
#define TCP_BUFFER_LENGTH 32 |
enum tcpstate_t |
Open a TCP socket connection.
in | Pointer to a tcpinfo_t struct to save state into. |
path | The address:port to which we should connect to. |
Closes a TCP socket connection.
@parm in Pointer to a tcpinfo_t that is to be closed.
You want to run this every frame.
in | Pointer to an active TCP connection. |
tcpstate_t TCP_GetState | ( | tcpinfo_t * | in | ) |
Returns the tcpstate_t of a connection.
in | Pointer to an active TCP connection. |
Receive the latest message from a TCP connection.
in | Pointer to an active TCP connection. |