Udp/Ip Communications Programming Example - Omron CS1W-ETN11 Operation Manual

10base-5, 10base-t ethernet units
Hide thumbs Also See for CS1W-ETN11:
Table of Contents

Advertisement

Using Socket Services with Socket Service Request Switches
Continued from previous page.
000003
000203
000003
000203
000203
151904
000003
000003 000203
151904
6-2-9

UDP/IP Communications Programming Example

System Configuration
134
<>(305)
D30027
#0000
Note When using the above programming example, change the bit and word
addresses as necessary to avoid using the same areas used by other parts of
the user program or the CPU Bus Unit.
The following programming example illustrates transferring 100 bytes of data
between an Ethernet Unit and a host computer using UDP/IP communica-
tions.
The programming example uses the following system configuration.
Host computer
IP address:
Port number: 4096
When the TCP Receiving Flag (CIO 000203) turns ON,
MOV(21)
the following parameters are written to the parameter
#0001
area for socket number 1.
D30018: 0001 Hex = UDP/TCP socket No. 1
D30018
D30023: 0064 Hex = No. of send/receive bytes is 100
D30024 and D30025:
MOV(21)
8203 E800 Hex =
#0064
Send/receive data address D01000
D30026: 0000 Hex = No timeout time.
D30023
MOV(21)
#8203
D30024
MOV(21)
#E800
D30025
MOV(21)
#0000
D30026
After the parameter has been set, the Receive Request
SET
Switch (CIO 151904) is turned ON and the TCP Receiv-
151904
ing Flag (CIO 000203) is turned OFF.
RSET
000203
If the Receive Request Switch (CIO 151904) turns OFF
SET
while the TCP Receiving Flag (CIO 000203) is OFF, the
000103
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.
RSET
000003
After the execution results have been checked, the TCP
Receive Bit (CIO 000003) is turned OFF.
END(01)
196.36.32.55
IP address:
Port number: 4096
Section 6-2
Ethernet Unit
PC
196.36.32.101

Advertisement

Table of Contents
loading

Table of Contents