![background image](http://html1.mh-extra.com/html/omron/cs1w-etn01/cs1w-etn01_operation-manuals_742528126.webp)
6-2
Section
Using Socket Services with Socket Service Request Switches
114
MOV(21)
#0001
D30018
000003
000203
MOV(21)
#0064
D30023
MOV(21)
#8203
D30024
MOV(21)
#E800
D30025
SET
151904
000003
RSET
000203
000203
SET
000103
000003
000203
151904
<>(305)
D30027
#0000
RSET
000003
000003
000203
151904
MOV(21)
#0000
D30026
If the Receive Request Switch (CIO 151904) turns OFF
while the TCP Receiving Flag (CIO 000203) is OFF, the
contents of the response code (D30027) in the Socket
Service Parameter Area is checked, and if it is not 0000
Hex (normal end), the TCP Receive Error Flag (CIO
000103) is turned ON.
After the execution results have been checked, the TCP
Receive Bit (CIO 000003) is turned OFF.
After the parameter has been set, the Receive Request
Switch (CIO 151904) is turned ON and the TCP Receiv-
ing Flag (CIO 000203) is turned OFF.
When the TCP Receiving Flag (CIO 000203) turns ON,
the following parameters are written to the parameter
area for socket number 1.
D30018: 0001 Hex = UDP/TCP socket No. 1
D30023: 0064 Hex = No. of send/receive bytes is 100
D30024 and D30025:
8203 E800 Hex =
Send/receive data address D01000
D30026: 0000 Hex = No timeout time.
END(01)
Continued from previous page.
6-2-9 UDP/IP Communications Programming Example
The following programming example illustrates transferring 100 bytes of data
between an Ethernet Unit and a host computer using UDP/IP communications.
The programming example uses the following system configuration.
Host computer
Ethernet Unit
IP address:
196.36.32.55
Port number: 4096
IP address:
196.36.32.101
Port number: 4096
PC
Basic Operations
•
CIO 000000 is turned ON to request opening a UDP socket from the Ethernet
Unit.
•
CIO 000001 is turned ON to request closing the UDP socket from the Ethernet
Unit.
•
CIO 000002 is turned ON to request sending data from the Ethernet Unit.
System Configuration