Use TCP Server in conjunction with the Message Composer for applications that require a proprietary Ethernet communication protocol. Do not use this feature with communication protocols such as MODBUS, or any protocol with built-in support.
The CPU can simultaneously support up to 32 TCP server/client and UDP sockets.
If: x = the number of TCP servers, y = the number
of TCP clients, and z = the number of UDP clients, then
x+y+z ≤ 32
Note that you can define up to 4 TCP Servers.
TCP Server is dynamic in nature. Each Server can handle up to 16 simultaneous connections.
How it works |
|
Set up Ethernet Addressing
On the Program Navigation tree, click PLC Communications>Physical>CPU Ethernet.
In the Properties Window, click the individual fields to enter the correct parameters.
Configure the Server
On the Program Navigation tree, click PLC Communications>Physical>CPU Ethernet>TCP Servers.
Click Add New.
Define a port: click the fields to name the server, assign a port, set the Number of Connections, and check Keep Alive.
Notes |
|
The TCP Server Struct
When you configure a TCP Server, UniLogic automatically creates a supporting Global operand struct.
Name |
Data Type |
Description |
Comments |
Is Initialized |
Bit |
Server is initialized. |
|
Port Number |
UINT32 |
Displays the number of the Port of the server, as defined in the CPU Ethernet settings. |
|
Connection Array (Client ID) |
Bit Array |
This is a 16 bit array where each bit is linked to a Connection ID. When a connection is established, the relevant bit will turn ON. |
|
Client's IP Address |
UINT32 Array |
This is an array comprising 16 UINT32 operands. When the server receives a Connect request from a client, the client's IP address is stored in this array. The position of the IP address in this array is identical to the bit that is turned ON. |
|
Client's Port Number |
UINT32 array |
This is an array comprising 16 UINT32 operands. When the server receives a Connect request from a client, the client's port number is stored in this array. |
|
TX Success Counter |
UINT32 array |
The number of packets sent successfully per connection |
|
TX Fail Counter |
UINT32 array |
The number packets that failed to be sent per connection |
|
RX Success Counter |
UINT32 array |
The number of packets successfully received per connection |
|
RX Drop Length Error |
UINT32 array |
Dropped packets per connection, due to insufficient buffer size (user buffer) |
|
TCP/IP Ladder Functions
These include:
UDP Tx
UDP Rx
TCP Server Disconnect
TCP Client Tx
TCP Client Rx
TCP Client Connect
TCP Client Disconnect