
This command can be used to query socket information. It sends a list of all sockets (a snaphshot) to the I/O interface. Also the number of free system-wide packet buffers is displayed.
SSTAT? does not require any arguments.
ERR_OK (0) if the command succeeded.
ERR_NET_DOWN (39) if the network is not functioning or disabled
SSTAT?
Could produce the following output
TCP: 200 LSTN 0 0 1000 80 0 -
TCP: 198 LSTN 0 0 1000 21 0 -
TCP: 197 LSTN 0 0 1000 21 0 -
TCP: 0 CLSD 0 0 1000 80 2663 -
TCP: 0 CLSD 0 0 0 0 0 -
TCP: 0 CLSD 0 0 0 0 0 -
TCP: 0 CLSD 0 0 0 0 0 -
TCP: 0 CLSD 0 0 0 0 0 -
TCP: 0 CLSD 0 0 0 0 0 -
TCP: 0 CLSD 0 0 0 0 0 -
TCP: 0 CLSD 0 0 0 0 0 -
TCP: 0 CLSD 0 0 0 0 0 -
UDP: 0 OPEN 0 0 0 53 0 -
UDP: 0 CLSD 0 0 0 22122 0 -
UDP: 0 FREE 0 0 0 0 0 -
UDP: 0 FREE 0 0 0 0 0 -
UDP: 0 FREE 0 0 0 0 0 -
UDP: 0 FREE 0 0 0 0 0 -
POOL: 8
The list contains the following information:
1. The number of lines is the total amount of UDP and TCP sockets in the system.
2. The first entry per line is either UDP or TCP, that is the type of the socket. In the example above, there are 12 TCP and 6 UDP sockets.
3. The number behind the socket type is a handle number if the socket is open. If its zero, the socket is free.
4. The next entry is the socket state. For TCP sockets, this can be:
RSRVD - Reserved - The socket is allocated but not yet opened.
CLSD - Closed - The socket is free.
LSTN - Listening - The socket listens for incoming connection attempts.
SYNRC - SYN received - The socket is about to connect.
SYNSN - SYN sent - The socket tries to connect to a remote station.
FW1 - FIN-Wait1 - The socket waits to complete TCP closing sequence.
FW2 - FIN-Wait2 - The socket waits to complete TCP closing sequence.
CLSNG - Closing - The socket is about to close.
LASTACK - Last Ack - The socket waits for the last ack befor it is closing.
TMDWT - Timed wait - The socket is about to close (handles FIN retries)
CONN - Connected - The socket is connected. That is the only state where data transfer is possible.
For UDP sockets the state can be:
FREE - The socket is unused, was never used.
CLSD - The socket is closed.
OPEN - The socket is currently in use.
5. The next two numbers are the number of packet buffer that the socket currently holds. The first number shows how many packets are in the socket's receive list, while the second number is the amount of packets in the transmit list.
6. The next two numbers are the port numbers for that socket. First comes the local port and the second number is the remote port number
7. The last information in each line (shown as - in the example above) indicates the binding. If the socket is bound to a specific interface, either WLAN or ETH is displayed. If the socket is not bound, a minus sign is shown.
8. Finally, after all socket entries, the output ends with a single line that shows how many free packet buffers the memory pool has.
SSTAT? is only useful on modules that have a network interface.