7
SOCKET COMMUNICATION FUNCTION
The socket communication function allows data communication with the devices on Ethernet by TCP or UDP using various
dedicated instructions.
Program
*1 The area is used for storing data received from the connected open devices.
• For dedicated instructions used for the socket communication function, refer to Page 83 Socket
Communication Function Instructions.
• Access through routers is also available. When configuring the settings set the subnet mask pattern and
default gateway IP address. (Page 29 Communication via Router)
Port numbers
In socket communication, port numbers are used to identify respective communication and thereby multiple communications
are available both on TCP and UDP.
• For sending: Specify the port number of the CPU module from which data is sent, and the port number of the destination
device.
• For receiving: Specify the port number of the CPU module, and read the data sent to the port.
CPU module
(IP address: xx.xx.xx.xx)
Port
number A
Port
number B
Port
number C
Sending data
SP.SOCSND instruction
Socket communication
receive area
Connection No. 1
Connection No. 2
Connection No. 3
SP.SOCRCV instruction
Reading receive data
Connection No. 8
Ethernet
Sending UDP data from the port number A
of CPU module to the port number L of the
communication target device 1
Sending UDP data from the port number L
of the communication target device 1 to the
number L
port number A of CPU module
Sending data via TCP connection
Sending data via TCP connection
number M
Sending UDP data from the port number C
of CPU module to the port number N of the
communication target device 3
Sending UDP data from the port number N
of the communication target device 3 to the
number N
port number C of CPU module
*1
Receiving data
to
Communication target device 1
(IP address: yy.yy.yy.yy)
Port
Communication target device 2
(IP address: zz.zz.zz.zz)
Port
Communication target device 3
(IP address: ww.ww.ww.ww)
Port
7 SOCKET COMMUNICATION FUNCTION
External device
7
71