RtxTcpServer

The server sample creates a socket at the specified port. How this port gets used depends upon whether the server is operating in UDP or TCP mode.

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.

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 server 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 rtxtcpserver.rtss [options]

Win32 Usage

Rtxtcpserver.exe [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

n=0,1

0=disable Nagle Algorithm, 1=Enable Nagle Algorithm (default)

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)

/udp

Use UDP instead of defaulting to TCP

/s

Use single threading (multi-threaded is the default)

l=0,1

0=Use packets that fit inside standard Ethernet MTU, 1=Allow IP to break up packets and don't force packet to fit in MTU. Default=1

/m

Use: /m LocalIPAddress MulticastIPAddress

/?

Displays usage

 

See Also

IntervalZero.com | Support | Give Feedback