Publication 1766-RM001A-EN-P - October 2008
Socket Interface Using CIP Generic Messaging
489
If you put the controller in Program mode before existing socket instances
time out, the controller will disconnect all the connections and delete all
the socket instances.
Programming
Considerations
You should observe the following programming considerations.
TCP Connection Loss
Your application program may encounter conditions that result in TCP
connection loss. For example, a network cable can be unplugged, or a
target device can be turned off.
Your application program should detect the loss of TCP connections and
handle those events appropriately. You can detect connection loss when
a:
•
Read service returns with an error
•
Write service returns with an error. See Possible Error Codes for
Socket Services on page 508.
Depending on the application, you might want to:
•
fault the controller
•
try to re-establish the connection (in the case of a client connection),
or
•
wait for another incoming connection to be established (in the case
of a server connection).
If you want to re-establish communications with the other device, you
must:
•
delete the socket instance for the lost connection
•
if the connection is a client connection, create a new socket instance
and issue an OpenConnection service to the target device
•
if the connection is a server connection, issue an AcceptConnection
service to wait for another connection from the remote device.
IMPORTANT
Make sure the Inactivity Timeout is longer than the longest interval
between socket operations. If the Inactivity Timeout is too short,
socket instances may time out, resulting in MSG instruction errors.
efesotomasyon.com - Allen Bradley,Rockwell,plc,servo,drive