350
Appendix 9 Sample Program on the Connected Device
Side
The following shows a sample program for the connected device on the same Ethernet network as the E71. Each
program example describes only the minimum programming that is required to perform a communication test. Change
the IP address, port number and other values according to the system configuration used. Other processes such as a
process performed upon an error can be added.
(1) Receive process of the connected device
A receive processing example on the connected device side is shown below.
For Ethernet communications, the TCP socket functions are used inside the personal computer. However, these functions
do not have any limit. Therefore, when the "send" function is executed once to transmit data, the receiving side needs to
execute the "recv" function once or more to read the data ("send" and "recv" are not proportional to 1:1 execution). For this
reason, the receive process above is required.
Communication process on the connected device
Request message/send process
Response message/receive process
The TCP connection is closed.
Timeout of the monitoring timer value
Response message process
Have all the received messages
been processed?
End
Receive the remaining
response messages.
The received data size
is insufficient.
If the response message to
the next request has been
received
Error process
Check the received data size.
Is the TCP connection open?
Were the data
received within the monitoring
timer value?