Modules | |
TCP Socket Options | |
TCP Socket State | |
TCP Socket Status | |
Functions | |
int | listen4 (IPADDR4 addr, uint16_t port, uint8_t maxpend=5) |
Listen for incoming IPv4 connections. More... | |
int | accept4 (int listening_socket, IPADDR4 *address, uint16_t *port, uint16_t timeout) |
Accept an incoming IPv4 connection from a listening socket. More... | |
int | listen6 (const IPADDR6 &addr, uint16_t port, uint8_t maxpend=5) |
Listen for incoming IPv6 connections. More... | |
int | accept6 (int listening_socket, IPADDR6 *address, uint16_t *port, uint16_t timeout) |
Accept an incoming IPv6 connection from a listening socket. More... | |
int | connect4 (IPADDR4 ipAddress, uint16_t remotePort, uint32_t timeout, IPADDR4 interfaceIpAddress) |
Connect to a remote IPv4 host. More... | |
int | connect6 (const IPADDR6 &ipAddress, uint16_t remotePort, uint32_t timeout, const IPADDR6 &interfaceIpAddress) |
Connect to a remote IPv6 host. More... | |
int | NoBlockConnect4 (IPADDR4 ipAddress, uint16_t remotePort, IPADDR4 interfaceIpAddress=IPADDR4::NullIP()) |
Create a file descriptior and return immediately, does not wait for connection to complete. Before attempting to use the socket verify a connection was successful with TcpGetSocketState(fd). More... | |
int | NoBlockConnect6 (const IPADDR6 &ipAddress, uint16_t remotePort, const IPADDR6 &interfaceIpAddress) |
Create a file descriptior and return immediately, does not wait for connection to complete. Before attempting to use the socket verify a connection was successful with TcpGetSocketState(fd). More... | |
IPADDR4 | GetSocketRemoteAddr4 (int fd) |
Returns the IPv4 address of the remote host associated with the specified file descriptor. More... | |
IPADDR4 | GetSocketLocalAddr4 (int fd) |
Returns the IPv4 address of the local interface associated with the connection. More... | |
IPADDR6 | GetSocketRemoteAddr6 (int fd) |
Returns the IPv6 address of the remote host associated with the specified file descriptor. More... | |
IPADDR6 | GetSocketLocalAddr6 (int fd) |
Returns the IPv6 address of the local interface associated with the connection. More... | |
uint16_t | GetSocketRemotePort (int fd) |
Returns the port number of the remote host associated with the connection. More... | |
uint16_t | GetSocketLocalPort (int fd) |
Returns the local port number associated with the connection. More... | |
uint32_t | TcpGetLastRxTime (int fd) |
Returns the value of system Time Ticks when the last packet was received. Used for the TCP Keep Alive feature. More... | |
void | TcpSendKeepAlive (int fd) |
Send a TCP keep alive packet to a remote host. More... | |
uint32_t | TcpGetLastRxInterval (int fd) |
Returns the number of system Time Ticks since the last packet was received. This is the difference between the current system time and lastRxTime of the socket. More... | |
int | GetTcpRtxCount (int fd) |
Returns the number of re-transmits that have occured on the specified connection. More... | |
int | setsockoption (int fd, int option) |
Set TCP socket options. More... | |
int | clrsockoption (int fd, int option) |
Clear TCP socket options. More... | |
int | getsockoption (int fd) |
Returns the options for the specified TCP socket. More... | |
char | SocketPeek (int fd) |
Returns the next char that would be read, 0 if no data. More... | |
int | TcpGetSocketInterface (int fd) |
Return the network interface asociated with a TCP socket. More... | |
uint8_t | TcpGetSocketState (int fd) |
Return the current state of a TCP socket. More... | |
The NetBurner TCP Group
int accept4 | ( | int | listening_socket, |
IPADDR4 * | address, | ||
uint16_t * | port, | ||
uint16_t | timeout | ||
) |
Accept an incoming IPv4 connection from a listening socket.
Calling accept() in dual stack mode will automatically select the correct IPv4/IPv6 function.
Begin listening for incoming connections. A connection must be accepted with the accept() function before they can be used. Each time a connection request is accepted is frees up another slot in the pending queue.
listening_socket | The listening socket from which to accept the connection. |
*address | Pointer to an IPADDR object that will receive the IPADDR information for the connection. Can be NULL. |
*port | Pointer to the variable that receive the port number of the connection. Can be NULL. |
timeout | Number of system Time Ticks to wait. A value of 0 waits forever. |
int accept6 | ( | int | listening_socket, |
IPADDR6 * | address, | ||
uint16_t * | port, | ||
uint16_t | timeout | ||
) |
Accept an incoming IPv6 connection from a listening socket.
Calling accept() in dual stack mode will automatically select the correct IPv4/IPv6 function.
Begin listening for incoming connections. A connection must be accepted with the accept() function before they can be used. Each time a connection request is accepted is frees up another slot in the pending queue.
listening_socket | The listening socket from which to accept the connection. |
*address | Pointer to an IPADDR object that will receive the IPADDR information for the connection. Can be NULL. |
*port | Pointer to the variable that receive the port number of the connection. Can be NULL. |
timeout | Number of system Time Ticks to wait. A value of 0 waits forever. |
int clrsockoption | ( | int | fd, |
int | option | ||
) |
Clear TCP socket options.
fd | Socket file descriptor. |
option | Socket option to clear: TCP Socket Options. |
|
inline |
Connect to a remote IPv4 host.
Calling connect() in dual stack mode will automatically select the correct IPv4/IPv6 function.
By default it will use the fist network interface.
ipAddress | IP address of the remote host. |
remotePort | Port number of the remote host. |
timeout | Number of system Time Ticks to wait. A value of 0 waits forever. |
interfaceIpAddress | Optional parameter to specify which local network interface to use for the connection. The default is 0, which is the first network interface in the configuration. |
|
inline |
Connect to a remote IPv6 host.
Calling connect() in dual stack mode will automatically select the correct IPv4/IPv6 function.
By default it will use the fist network interface.
ipAddress | IP address of the remote host. |
remotePort | Port number of the remote host. |
timeout | Number of system Time Ticks to wait. A value of 0 waits forever. |
interfaceIpAddress | Optional parameter to specify which local network interface to use for the connection. The default is 0, which is the first network interface in the configuration. |
IPADDR4 GetSocketLocalAddr4 | ( | int | fd | ) |
Returns the IPv4 address of the local interface associated with the connection.
Calling GetSocketLocalAddr() in dual stack mode will automatically select the correct IPv4/IPv6 function.
fd | The socket file descriptor. |
IPADDR6 GetSocketLocalAddr6 | ( | int | fd | ) |
Returns the IPv6 address of the local interface associated with the connection.
Calling GetSocketLocalAddr() in dual stack mode will automatically select the correct IPv4/IPv6 function.
fd | The socket file descriptor. |
uint16_t GetSocketLocalPort | ( | int | fd | ) |
Returns the local port number associated with the connection.
fd | The socket file descriptor. |
IPADDR4 GetSocketRemoteAddr4 | ( | int | fd | ) |
Returns the IPv4 address of the remote host associated with the specified file descriptor.
Calling GetSocketRemoteAddr() in dual stack mode will automatically select the correct IPv4/IPv6 function.
fd | The socket file descriptor. |
IPADDR6 GetSocketRemoteAddr6 | ( | int | fd | ) |
Returns the IPv6 address of the remote host associated with the specified file descriptor.
Calling GetSocketRemoteAddr() in dual stack mode will automatically select the correct IPv4/IPv6 function.
fd | The socket file descriptor. |
uint16_t GetSocketRemotePort | ( | int | fd | ) |
Returns the port number of the remote host associated with the connection.
fd | The socket file descriptor. |
int getsockoption | ( | int | fd | ) |
Returns the options for the specified TCP socket.
fd | Socket file descriptor. |
int GetTcpRtxCount | ( | int | fd | ) |
Returns the number of re-transmits that have occured on the specified connection.
fd | The socket file descriptor. |
int listen4 | ( | IPADDR4 | addr, |
uint16_t | port, | ||
uint8_t | maxpend = 5 |
||
) |
Listen for incoming IPv4 connections.
Calling listen() in dual stack mode will automatically select the correct IPv4/IPv6 function.
Begin listening for incoming connections. A connection must be accepted with the accept() function before they can be used. Each time a connection request is accepted is frees up another slot in the pending queue.
addr | The address from which to accept connections. If you want to accept connections from anywhere pass in the value INADDR_ANY. |
port | The port number to listen on. |
maxpend | The maximum number of pending connection requests allowed for this listen socket. If not specified, the default is 5. |
int listen6 | ( | const IPADDR6 & | addr, |
uint16_t | port, | ||
uint8_t | maxpend = 5 |
||
) |
Listen for incoming IPv6 connections.
Calling listen() in dual stack mode will automatically select the correct IPv4/IPv6 function.
Begin listening for incoming connections. A connection must be accepted with the accept() function before they can be used. Each time a connection request is accepted is frees up another slot in the pending queue.
&addr | The address from which to accept connections. If you want to accept connections from anywhere pass in the value INADDR_ANY. |
port | The port number to listen on. |
maxpend | The maximum number of pending connection requests allowed for this listen socket. If not specified, the default is 5. |
|
inline |
Create a file descriptior and return immediately, does not wait for connection to complete. Before attempting to use the socket verify a connection was successful with TcpGetSocketState(fd).
Calling NoBlockConnect() in dual stack mode will automatically select the correct IPv4/IPv6 function.
By default it will use the fist network interface.
ipAddress | IP address of the remote host. |
remotePort | Port number of the remote host. |
timeout | Number of system Time Ticks to wait. A value of 0 waits forever. |
interfaceIpAddress | Optional parameter to specify which local network interface to use for the connection. The default is 0, which is the first network interface in the configuration. |
|
inline |
Create a file descriptior and return immediately, does not wait for connection to complete. Before attempting to use the socket verify a connection was successful with TcpGetSocketState(fd).
Calling NoBlockConnect() in dual stack mode will automatically select the correct IPv4/IPv6 function.
By default it will use the fist network interface.
ipAddress | IP address of the remote host. |
remotePort | Port number of the remote host. |
timeout | Number of system Time Ticks to wait. A value of 0 waits forever. |
interfaceIpAddress | Optional parameter to specify which local network interface to use for the connection. The default is 0, which is the first network interface in the configuration. |
int setsockoption | ( | int | fd, |
int | option | ||
) |
Set TCP socket options.
fd | Socket file descriptor. |
option | Socket option to set: TCP Socket Options. |
char SocketPeek | ( | int | fd | ) |
Returns the next char that would be read, 0 if no data.
fd | Socket file descriptor. |
uint32_t TcpGetLastRxInterval | ( | int | fd | ) |
Returns the number of system Time Ticks since the last packet was received. This is the difference between the current system time and lastRxTime of the socket.
fd | The socket file descriptor. |
uint32_t TcpGetLastRxTime | ( | int | fd | ) |
Returns the value of system Time Ticks when the last packet was received. Used for the TCP Keep Alive feature.
Each TCP connection has a corresponding Socket_struct. One of the elements of this struct is a variable called lastRxTime, which stores the current system time tick every time a packet is received. This function enables you to find out when the last packet was received by returning LastRxTime.
This function is used in conjuntion with TcpSendKeepAlive() to implement the TCP keepalive feature.
fd | The socket file descriptor. |
int TcpGetSocketInterface | ( | int | fd | ) |
Return the network interface asociated with a TCP socket.
fd | Socket file descriptor. |
uint8_t TcpGetSocketState | ( | int | fd | ) |
Return the current state of a TCP socket.
fd | Socket file descriptor. |
void TcpSendKeepAlive | ( | int | fd | ) |
Send a TCP keep alive packet to a remote host.
Sends an empty packet with a decremented sequence number to a remote host. The sequence number will be one less than the last time a packet was sent. The remote host will respond with a TCP acknowledgment (ACK). This function is used in conjuntion with TcpGetLastRxTime() to implement the TCP keepalive feature.
fd | The socket file descriptor. |