Examples/applications
10.1 Basic principles of socket programming, exemplary in C
RF182C communication module
82
Operating Instructions, 10/2010
10.1.2
Basic client/server principle
$FWLYDWLRQRIWKHVHUYHU
(VWDEOLVKFRQQHFWLRQ
5HFHLYHZULWHGDWD
&ORVHFRQQHFWLRQ
6HUYHU
&OLHQW
6RFNHW
%LQG
/LVWHQ
$FFHSW
&ORVH
5HFY6HQG
6RFNHW
&RQQHFW
&ORVH
5HFY6HQG
Figure 10-1 Basic client/server principle
10.1.3
Important basic commands
Commands/functions
Description
Socket()
Initialization and parameter transfer of a new socket
Bind()
Assignment of a user (IP address and port number) to a socket
Lists()
Ready to connect
Connect()
Function for connecting the client to the server via TCP/IP
Accept()
Wait function of server until a client connects
Send()
Sending data
Recv()
Receiving data
Close()
Closing the socket after completing data transmission.
When working with the RF182C, a Close usually only occurs when the
system is shut down.
Note
No parameters or return values of the individual functions are listed here since they may
differ in the different operating systems/programming languages.
The names of the functions are examples only, they may differ in the operating
systems/programming languages. These function examples are limited to the basic
principles of the client/server representation – only a partial example of the functions is
shown.