6 F 3 B 0 3 6 2
f.TCP reception processing example (Socket status monitoring type)
Ladder program flowchart | Error result |
TCP reception processing start
Socket status read/verify
Are bits B and F both 1? | No |
(Is a connection established?) |
|
Yes |
|
Is bit 9 set to 0? | No |
(In the state other than RCLOSE?) |
|
Yes |
|
Is bit A set to 1? | No |
(Reception text present.) |
|
Yes |
|
|
|
Execute a TCP receive request |
|
(CMD = 0038H). |
|
|
|
Hold the input of function block in the on state until the RECV instruction completes.
Instruction completion
The processing in this section can be performed at this stage or at the point the instruction terminates abnormally.
A connection has not been established with the specified TCP socket. (Open processing is required.)
The specified TCP socket is:
•Closed by the remote port
(The socket must be closed by the local port.)
The specified TCP socket has not received data.
Verify the status
Normal complete?
No
An error occurred in reception processing. The specified socket coule not receive the data.
Handle the error according to the completion and socket status.
Yes
Terminate TCP reception processing