Programming considerations, Tcp connection loss, Web server module reset – Rockwell Automation 1768-EWEB EtherNet/IP Web Server Module User Manual User Manual

Page 135: Tcp connection loss web server module reset

Advertising
background image

Publication ENET-UM527E-EN-P - October 2006

Socket Interface 135

Programming
Considerations

Observe these 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 other than EWOULDBLOCK.

See Possible Error Codes for Socket Services on page 155.

Depending on the application, you might want to:

• fault the controller.
• try to re-establish the connection (in the case of a client

connection).

• 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.

Web Server Module Reset

If the web server module is reset, for example, by cycling power or
with Removal and Insertion Under Power (RIUP), all socket instances
are lost.

If you create new socket instances while MSG instructions are still
using the the old instance numbers, there is a possibility that the new
instance numbers will match the old instance numbers. In this

Advertising
This manual is related to the following products: