Chapter 6 Applied Instructions 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 sent through the TCP socket, and no error occurs after the instruction is executed, the data is sent, and the flag related to the data’s being sent is ON. If the data is sent successfully, the flag related to the data’s having been sent is ON, and the flag related to the data’s being sent is OFF. If an error occurs, the error flag is ON. 5. If the data is sent through the UDP socket, and no error occurs after the instruction is executed, the flag related to the data’s having been sent is ON. If an error occurs, the error flag is ON. 6. Generally, the pulse instruction SSENDP is used.
6-511 API Instruction code Operand Function 2201 SSEND P S , S 1 2 Sending the data through the socket Device X Y M S T C HC D L SM SR E PR K 16# “$” DF S 1 S 2 Pulse instruction 16-bit instruction (5 steps) 32-bit instruction AH500 AH500 - TCP socket number Being sending the data Having sent the data Error flag 1 SM1275 SM1272 SM1277 2 SM1283 SM1280 SM1285 3 SM1291 SM1288 SM1293 4 SM1299 SM1296 SM1301 5 SM1307 SM1304 SM1309 6 SM1315 SM1312 SM1317 7 SM1323 SM1320 SM1325 8 SM1331 SM1328 SM1333 UDP socket number Having sent the data Error flag 1 SM1336 SM1338 2 SM1341 SM1343 3 SM1346 SM1348 4 SM1351 SM1353 5 SM1356 SM1358 6 SM1361 SM1363 7 SM1366 SM1368 8 SM1371 SM1373