Chapter 6 Applied Instructions
6-513
API
Instruction code
Operand Function
2202 SRCVD P
S
1
, S
2
Receiving the data through the socket
Device
X Y M S T C HC D L SM SR E PR K 16# “$” DF
Pulse instruction 16-bit instruction (5 steps)
32-bit instruction
Symbol:
S
1
:
Socket mode Word
S
2
:
Socket number Word
Explanation:
1. S
1
is 1 if users want to open the TCP socket, and S
1
is 0 if users want to open the UDP socket.
S
2
is the socket number.
2. The operand S
1
should be either 0 or 1, and the operand S
2
should be within the range between
1 and 8.
3. Before using this instruction, users need to use the instruction SOPEN to open the socket. If the
flag related to the connection’s being successful is ON, or the flag related to the connection’s
having been started is ON, this instruction can be used.
4. If the data is received through the TCP socket, and no error occurs after the instruction is
executed, the data is received, and the flag related to the data’s being received is ON. If the data
is received successfully, the flag related to the data’s having been received is ON, and the flag
related to the data’s being received is OFF. If an error occurs, the error flag is ON.
TCP socket number
data
data
Error flag
5. If the data is received through the UDP socket, and no error occurs after the instruction is
executed, the flag related to the data’s being received is ON. After the data is received, the flag
related to the data’s having been received is ON. If an error occurs, the error flag is ON.
UDP socket number
Error flag