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
An additional advantage of
The disadvantages to
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
TCP/IP Ethernet Communications for the Series 90™ PLC User's Manual– May 2002 |
|