Appendix C: Program Examples
132
FX
3U
-ENET-ADP User's Manual
Appendix C: Program Examples
The program examples presented in this section test the connection between the Ethernet adapter and an
external device (personal computer) that is connected to the same Ethernet.
For each program, only the minimum programming that is required to perform the communication test is
done. Modify the IP address, port number and other values according to your system configuration. In
addition, handling for abnormalities may be added.
1) Receive processing of target device
A receive processing example on the target device side is shown below.
<Background>
For Ethernet communications, the TCP socket functions are used inside the personal computer. However,
these functions do not have any limits. Therefore, when the "send" function is executed once to transmit data,
the receiving end (node) needs to execute the "recv" function once or more in order to read the data ("send"
and "recv" is not proportional to 1:1 execution). For this reason, the receiving procedure explained above, is
required.
Request message/transmission processing
Response message/reception processing
Is the TCP connection open?
The TCP connection is closed
Timeout of monitoring timer
Error handling
End
If a response message to the
next request was received
Receive remaining
response messages
Insufficient size
of data received
Check the size of the received data
Was the reception data
received within the time allotted
by the monitoring timer?
Response message processing
Have all the received
messages been processed?
Communication processing
on the external device side
Summary of Contents for FX3U-ENET-ADP
Page 1: ...FX3U ENET ADP USER S MANUAL ...
Page 2: ......
Page 6: ... 4 Safety Precautions Read these precautions before use MEMO ...
Page 161: ......