Ethernet Units Operation Manual

127
Using Socket Services with Socket Service Request Switches Section 6-2
Precautions
A Socket Service Parameter Area cannot be used for other sockets once
open processing has been successfully completed for it. Check the socket
status before attempting to open a socket. TCP socket status is provided in
words m+9 to m+16 in the DM Area for sockets 1 to 8.
TCP Connection Status
The TCP connection status is provided for ports for which TCP sockets have
been opened. When a port is closed, the previous status will remain in the DM
Area until a socket is opened again. Writing data to the DM Area, however, is
not synced with writing to the Socket Status Areas, and timing may vary
somewhat.
Status in indicated in bits 0 to 3 using the 1-digit hexadecimal codes shown in
the following table.
6-2-6 Socket Services and Socket Status
When using socket services, it is important to consider the timing of the status
changes in the Socket Status Area. The diagram below shows a flowchart for
opening UDP.
TCP connection status
m+9 to m+16
151413121110987654321
0
Code Status Meaning
0 CLOSED Connection closed.
1 LISTEN Waiting for connection.
2 SYN SENT Active and waiting for SYN.
3 SYN RECEIVED SYN sent and received.
4 ESTABLISHED Connection established.
5 CLOSE WAIT FIN received and waiting for close.
6 FIN WAIT1 Finished and FIN sent.
7 CLOSING Finished and FIN exchanged. Waiting for acknowledge-
ment of FIN arrival.
8 LAST ACK FIN received and finished. Waiting for acknowledgement
of FIN arrival.
9 FIN WAIT2 FIN arrival acknowledged. Waiting for FIN.
A TIME WAIT Finished and waiting for silence for twice the maximum
segment life (2MSL).