Appendix 10 Sample Program On The Connected Device Side - Mitsubishi Electric QJ71E71-100 User Manual

Q corresponding ethernet interface module
Table of Contents

Advertisement

Appendix 10
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.
Receive the remaining
response messages.
The received data size
is insufficient.
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.
396
Sample Program on the Connected Device
Side
Communication process on the connected device
Request message/send process
Response message/receive process
Is the TCP connection open?
Were the data
received within the monitoring
timer value?
Check the received data size.
Response message process
Have all the received messages
been processed?
End
The TCP connection is closed.
Timeout of the monitoring timer value
If the response message to
the next request has been
received
Error process

Advertisement

Table of Contents
loading

This manual is also suitable for:

Qj71e71-b5Qj71e71-b2

Table of Contents