3

Managing Channels and TCP Connections

In Certain Conditions TCP Connections Can Be Totally Consumed

When you issue a COMMREQ to establish a read or write channel, a TCP connection is created, the transfer(s) are made, then upon completion of all the transfers, the TCP connection is terminated. It takes time to create and to terminate these connections. If an application is constructed so that it rapidly and repeatedly establishes a channel with only one repetition (one transfer), the available TCP connections for the Ethernet Interface may be totally consumed. A “snapshot” of the state of the TCP connections would show some of them being created, some being terminated, and some active, but none available.

Specifically, if your ladder program for issuing COMMREQs is constructed so it does the following, all available TCP connections can quickly be used up:

ƒThe number of repetitions (Word 9 in an Establish Read or Write Channel COMMREQ) is set to 1, and

ƒA new COMMREQ is issued repeatedly and immediately upon completion of the prior one.

Use “Channel Re-Tasking” To Avoid Using Up TCP Connections

The most likely scenario for using up TCP connections is when each successive COMMREQ is directed to the same target device (same IP address or Network Address name). In this case, it is better to establish a channel with the target device once, leave it active, then re-task the channel, even if data transfers take place infrequently. This method will use only one TCP connection.

An additional advantage of re-tasking is that the time and network traffic required to create a channel and its associated TCP connection are not incurred each time a data transfer is required.

The disadvantages to re-tasking are:

ƒWhile the TCP connection is open, it is unavailable to the rest of your application, and

ƒThe active TCP connection uses up network bandwidth because the active TCP connection generates a small amount of ongoing periodic network traffic.

How To Re-Task a Channel

1. For Establish Read/Write Channel Commands, set the number of repetitions (COMMREQ Word 9) to 2 and set the read/write period (COMMREQ Words 10 and 11) to be longer than the expected time between transfers. For example, if you expect to transfer data about once per minute, set the read/write period to about two minutes. This will cause a TCP connection to be created and held open for two minutes.

2. Set up the ladder program to:

A. Issue the first COMMREQ and wait for the first transfer to complete, which will be indicated when the COMMREQ Status (CRS) word is changed to 1.

B. Then before the read/write period expires (at which time the second and final transfer is sent and the TCP connection is dropped), issue the next COMMREQ with the same parameters as specified in step 1. This will “re-task” the channel to use the existing TCP connection instead of opening a new one, and will send another data transfer restarting the timer for the read/write period. Repeat step 2B for each successive data transfer desired.

3-48

TCP/IP Ethernet Communications for the Series 90™ PLC User's Manual– May 2002

GFK-1541B

Page 115
Image 115
GE GFK-1541B manual Managing Channels and TCP Connections, Use Channel Re-Tasking To Avoid Using Up TCP Connections