Overview of Socket Communications from Ethernet Units

Section 6-1

6-1 Overview of Socket Communications from Ethernet Units

6-1-1 What are Sockets?

Sockets are interfaces that allow TCP and UDP protocols to be used directly from the user program. With personal computers, socket are provided as C language interface libraries, which allow TCP or UDP protocols to be programming using library functions. With UNIX computers, socket interfaces are supported in the form of system calls.

The CS/CJ-series PLCs support the socket service from the user program. The user program requests service functions either by manipulating Socket Service Request Switches in the CPU Bus Unit Area in the CIO Area or by sending FINS commands to the Ethernet Unit by executing CMND(490) instruction in the ladder diagram.

Socket communications services can be used to transfer arbitrary data between a PLC and a host computer or between two PLCs. The Ethernet supports two socket services: a UDP socket service and a TCP socket service.

Using Sockets with the Ethernet Unit

The Ethernet Unit supports up to 16 simultaneous socket connections for the socket services, 8 each for UDP and TCP sockets.

Socket numbers 1 to 8 are assigned to sockets for both UDP and TCP sockets. Sockets are managed from the ladder-diagram program by assigning a socket port for each socket number. The socket port number is assigned when the socket is opened.

Socket ports are assigned to socket

UDP socketnumbers. port 1

UDP socket 1

Sockets

UDP open request

Socket services

TCP socket 8

TCP socket port 65535

6-1-2 Socket Port Numbers

Port numbers up to 1023 on a UNIX workstation can be used by the superuser only. Port numbers 0 to 255 are reserved for well-known ports. Consequently, port numbers 1024 and above should be used for socket services. The Ethernet Unit does not support port #0.

Some port numbers over 1024 may be reserved on some workstations (for example, the X-window server is port #6000). Do not use port numbers that are already reserved for other processes.

The setting status of the UNIX workstation port numbers can be checked in / etc/services.

99

Page 123
Image 123
Omron CJ1W-ETN21 Overview of Socket Communications from Ethernet Units, What are Sockets?, Socket Port Numbers