NetBurner 3.5.8
PDF Version
tcp_test_server Namespace Reference

Functions

 broadcast (data)
 
 input_loop ()
 

Detailed Description

Simple interactive TCP test server for exercising NetBurner TCP client examples
(e.g. examples/TCP/NoBlockConnectTest).

On each incoming connection it:
  * immediately sends a greeting line,
  * optionally sends a "server tick N" line every 2 seconds (--ticks), and
  * prints everything it receives from the client.

Anything you TYPE in this server's window is forwarded to the connected
client(s), so you can interactively send data to the device. On Windows each
keystroke is sent as you type it; on other platforms input is line-buffered
(sent when you press Enter).

This lets you verify BOTH directions of a NetBurner TCP client:
  * receive  -- the greeting, ticks, and anything you type here should appear
                on the device's console,
  * transmit -- whatever the device sends (typed characters, periodic
                heartbeats, etc.) is printed here.

Usage:
    python tcp_test_server.py [port] [--ticks]

    port     TCP port to listen on (default 32001).
    --ticks  Also auto-send a "server tick N" line every 2 seconds.

Point the NetBurner example at this PC's IP address and the chosen port.
Press Ctrl-C to stop the server.

Function Documentation

◆ broadcast()

tcp_test_server.broadcast ( data)
Send data to every connected client; drop any that error out.

◆ input_loop()

tcp_test_server.input_loop ( )
Read keystrokes from this window and forward them to all clients.