www.beck-ipc.com

@CHIP-RTOS C Library V2.00 - TCP/IP API


Get_TCP_Socket_State

Find TCP socket and return its state.

unsigned char Get_TCP_Socket_State ( unsigned int localPort,
                                     unsigned long far *remoteIP,
                                     unsigned int *remotePort );

Parameters

localPort

Local port (e.g. htons(23) for telnet).

remoteIP

Output parameter:  Pointer to storage for 32 bit remote IP address.

remotePort

Output parameter:  Pointer to storage for 16 bit remote peer port number.

Return Value

Socket state (see list below)

Comments

Search for a TCP socket by a given local port number, returning the socket state, IP address and port number of the remote peer (if any).

This function is only available in @CHIP-RTOS versions which contain the SNMP MIB feature.

If the return value is not INVALID (=20) and is greater or equal to SYN_SENT (=2) then a TCP connection is established.  In this case the storage at remoteIP holds the 32 bit IP address of the connected remote peer and remotePort contains the remote peer port number.

Possible TCP socket states:

CLOSED          0
LISTEN          1
SYN_SENT        2
SYN_RECEIVED    3
ESTABLISHED     4
CLOSE_WAIT      5
FIN_WAIT_1      6
CLOSING         7
LAST_ACK        8
FIN_WAIT_2      9
TIME_WAIT      10
INVALID        20

See Also

RTOS API

This library function invokes a RTOS software interrupt. Refer to this RTOS API function's documentation for more details.


This API List
List of C Libraries
@CHIP-RTOS Main Index


End of document