Data Structures | |
struct | tcp_socket |
TCP socket information structure. More... | |
struct | tcp_socket |
TCP socket information structure. More... | |
Defines | |
#define | SO_FIN 0x01 |
Send FIN after all data has been transmitted. | |
#define | SO_SYN 0x02 |
Send SYN first. | |
#define | SO_FORCE 0x08 |
Force sending ACK. | |
#define | SO_ACK 0x10 |
Send ACK. | |
Typedefs | |
typedef tcp_socket | TCPSOCKET |
TCP socket type. | |
Functions | |
void | NutTcpDestroySocket (TCPSOCKET *sock) |
Destroy a previously allocated socket. | |
TCPSOCKET * | NutTcpFindSocket (u_short lport, u_short rport, u_long raddr) |
Find a matching socket. | |
TCPSOCKET * | NutTcpCreateSocket (void) |
Create a TCP socket. | |
int | NutTcpSetSockOpt (TCPSOCKET *sock, int optname, CONST void *optval, int optlen) |
Set value of a TCP socket option. | |
int | NutTcpGetSockOpt (TCPSOCKET *sock, int optname, void *optval, int optlen) |
Get a TCP socket option value. | |
int | NutTcpConnect (TCPSOCKET *sock, u_long addr, u_short port) |
Connect to a remote socket. | |
int | NutTcpAccept (TCPSOCKET *sock, u_short port) |
Wait for incoming connect from a remote socket. | |
int | NutTcpSend (TCPSOCKET *sock, void *data, u_short len) |
Send data on a connected TCP socket. | |
int | NutTcpReceive (TCPSOCKET *sock, void *data, u_short size) |
Receive data on a connected TCP socket. | |
int | NutTcpCloseSocket (TCPSOCKET *sock) |
Close TCP socket. | |
int | NutTcpError (TCPSOCKET *sock) |
Return specific code of the last error. | |
Variables | |
TCPSOCKET *volatile | tcpSocketList = 0 |
|
Wait for incoming connect from a remote socket. The calling thread will be suspended until until an incoming connection request is received. This function is typically used by TCP server applications.
|
|
Close TCP socket. Note, that the socket may not be immediately destroyed after calling this function. However, the application must not use the socket after this call.
|
|
Connect to a remote socket. This function tries to establish a connection to the specified remote port of the specified remote server. The calling thread will be suspended until a connection is successfully established or an error occurs. This function is typically used by TCP client applications.
|
|
Create a TCP socket. Allocates a TCPSOCKET structure from heap memory, initializes it and returns a pointer to that structure. The first call will also start the TCP timer, which is required by various timeout checks.
|
|
Destroy a previously allocated socket. Remove socket from the socket list and release occupied memory. Applications typically do not need to call this function. It is automatically called by a timer after the socket has been closed by NutTcpCloseSocket().
|
|
Return specific code of the last error. Possible error codes (net/errno.h) are:
|
|
Find a matching socket. Loop through all sockets and find a matching connection (prefered) or a listening socket. Applications typically do not need to call this function.
|
|
Get a TCP socket option value. The following values can be set:
|
|
Receive data on a connected TCP socket.
|
|
Send data on a connected TCP socket.
|
|
Set value of a TCP socket option. The following values can be set:
|
|
Linked list of all TCP sockets. |