Chapter 6 Applied Instructions Symbol S 1 : Socket mode S 2 : Socket number Explanation 1. This instruction sends data through the socket specified by S 1 . Set S 1 to 1 to open a TCP socket, and set S 1 to 0 to open a UDP socket. 2. S 2 is the socket number. It should correspond to the Ethernet socket number; up to 4 can be set. 3. The operand S 1 must be either 0 or 1 (default: 0); the operand S 2 must be between 1–4 (default: 1). If exceeding the range, error code H’2003 shows on the PLC. 4. Before using this instruction, use the SOPEN instruction (API 2200) to open the socket.
If the flags for the successful connection of the TCP socket or the flag for started connection of the UDP socket is ON, you can use this instruction. 5. If data is sent through a TCP socket, and no error occurs after the instruction is executed, the data is sent, and the flag for sending data is ON. If data is sent successfully, the flag for sent data is ON, and the flag for sending data is OFF. If an error occurs, the error flag is ON.
6-697 API Instruction code Operand Function 2201 SSEND P S1,S2 Sending data through a socket Device X Y M S T C HC D FR SM SR E K 16# “$” F S1 S2 BOOL WORD DWORD LWORD UINT INT DINT LINT REAL LREAL TMR CNT STRING Data type S1 S2 Pulse instruction 16-bit instruction 32-bit instruction ES3 ES3 - 6 6 _ TCP Socket Number Data Sending Data Sent Error Flag 1 SM1275 SM1272 SM1277 2 SM1283 SM1280 SM1285 3 SM1291 SM1288 SM1293 4 SM1299 SM1296 SM1301