@CHIP-RTOS C Library V2.06 - 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 IPv4 address.
remotePort
- Output parameter: Pointer to storage for
16 bit remote peer port number.
Return Value
- Socket state (see list below)
Comments
- This API searches 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).
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:
0: CLOSED
1: LISTEN
2: SYN_SENT
3: SYN_RECEIVED
4: ESTABLISHED
5: CLOSE_WAIT
6: FIN_WAIT_1
7: CLOSING
8: LAST_ACK
9: FIN_WAIT_2
10: TIME_WAIT
20: INVALID
SC1x3 Comments- Deprecated, because only IPv4 addresses can be stored at the
provided 32-bit buffer at remoteIP
. The alternative
Get_TCP_Socket_State_IP_All API is
instead recommended, which covers both IPv4 and IPv6 protocols.
See Also
RTOS API
- This library function invokes a RTOS software interrupt.
Refer to this RTOS API function's
documentation
for more details.
Supported since or modified in @CHIP-RTOS version-
SC12 | SC13 | SC11 | SC1x3 |
-
V1.04 | V1.00 | V1.00 | V0.90 |
This API List
List of C Libraries
@CHIP-RTOS Main Index
End of document
|