Omron CS1W-ETN11 Benutzerhandbuch

Seite von 317
130
Using Socket Services with Socket Service Request Switches
Section 6-2
6-2-8
TCP/IP Communications Programming Example
The following programming example illustrates transferring 100 bytes of data
between an Ethernet Unit and a host computer using TCP/IP communica-
tions.
System Configuration
The programming example uses the following system configuration. For the
TCP connection, the Ethernet Unit uses a passive open and the host com-
puter uses an active open.
Data Flow
The data will flow between the CPU Unit, Ethernet Unit, and host computer as
shown in the following diagram.
Note Here, “execution bits” refer to CIO 000000 to CIO 000003, which are used in
the ladder diagram to control execution of communications.
Basic Operations
• CIO 000000 is turned ON to request opening a TCP socket from the
Ethernet Unit.
• CIO 000001 is turned ON to request closing the TCP socket from the
Ethernet Unit.
• CIO 000002 is turned ON to request sending data from the Ethernet Unit.
Data (100 bytes) is sent beginning at D00000.
• CIO 000003 is turned ON to request receiving data from the Ethernet
Unit. The data that is received (100 bytes) is stored beginning at D01000.
• One of the bits between CIO 000100 and CIO 000103 will turn ON if an
error occurs. Refer to 6-2-2 Response Codesfor information on errors.
Host computer
Ethernet Unit
IP address:      196.36.32.55
Port number:   4096
IP address:      196.36.32.101
Port number:   4096
PC
Host computer
Line 
(Ethernet)
Ethernet 
Unit
CPU Unit
Request Switches and ex-
ecution bits turned ON 
(See note.)
Sent to line.
Processing in 
host computer
Execution bits turned OFF