RtTcpipServer
If operating in TCP mode, the main thread listens on this socket, accepts connections from clients and, by default, creates a new thread for each accepted connection to echo packets received on that connection. Multi-threaded operation of TCP can be disabled by a command line option. If operating in single threaded mode, new connections from clients are not accepted until the previous client has shut down its connection.
If operating in UDP mode, the main thread of server uses this socket to receive packets from all clients and to echo the packet back to the sender. UDP mode implies single threaded operation.
If a UDP socket is not bound to an IP address, and the system has configured several IP addresses on the same subnet as the destination IP address (or the route to the destination), UDP datagrams will be sent using the first IP address configured for this subnet.
The server sample runs indefinitely after started. To terminate the server, it must be killed with either the Windows Task Monitor (EXE images) or with RTSSkill (RTSS images).
The RtTcpipServer sample registers a shutdown handler with RTSS so that it can continue to run after a Windows Shutdown event. Once a shutdown has occurred, the server switches to single threaded mode to permit connections to be accepted and serviced without the need to create a new thread.
The various command line options are described below.
RTSS Usage
RTSSrun rttcpipserver.rtss [options]
Windows Usage
rttcpipserver.exe [options]
Options
Option | Description |
---|---|
i= |
Source IP address in dot notation (if needed) |
f=v4,v6 |
v4= IPv4(AF_INET) as address family v6= IPv6(AF_INET6) as address family Note: This is required for IPv6 addresses if the i= option is not specified. |
n=0,1 |
0=disable Nagle Algorithm (default), 1=Enable Nagle Algorithm Note: Both the client and the server must have the use of the Nagle Algorithm in the same state. Either both have the Nagle Algorithm disabled or both have the Nagle Algorithm enabled. |
p=nn |
Port number (default is 9999) |
r=nn | Report processed packets at an interval of every nn number of loops (default is 500) |
/udp |
Use UDP instead of defaulting to TCP |
/s |
Use single threading (multi-threaded is the default) |
/silent | No printouts will occur after initialization |
t=nn | Select timeout in ms. used with UDP send (default is 1000) |
w=nn | Socket window size (SO_SNDBUF and SO_RCVBUF) options |
/? |
Displays usage |
Related topics: