User guide
Ethernet Developers Guide
66  
840 USE 115 00 Version 1.0
B.3 Overview 
The sample application performs the followin
g
 steps:
Calls the window socket function 
socket
 to create a socket. 
Calls the window socket function 
setsockopt
 to set the socket attributes. 
Calls the window socket function 
connect
 to establish a connection. 
Encodes the re
q
uest. The re
q
uest consists of a header followed b
y
 a Modbus 
messa
g
e. The header contains an invoke identifier, a protocol t
y
pe, the 
command len
g
th, and a destination identifier.
Calls the window socket function 
send
 to transmit the re
q
uest to the remote 
node. 
Calls the window socket function 
recv
 to receive the response from the remote 
node. 
Calls the window socket function 
closesocket
 to close the connection and 
release the socket.
The winsock.lib import librar
y
 provided b
y
 the installation is used to link the window 
socket calls.
B.4 Development Environment 
The sample application was developed with Microsoft Visual C++, version 1.52. 
The sample application uses Microsoft Foundation Class. The initial application 
was 
g
enerated b
y
 the Visual C++ application wizard. 
Invoke Identifier Protocol Type Command Len
g
th Destination ID Modbus Messa
g
e










