This program installs a concurrent TCP echo server on port 5031.
To verify this program, first 'ping' the DSP:
>ping 192.168.168.200
If the settings and network connections are correct, the pings will be replied.
The TCP Echo server will re-send (echo) anything it receives. To verify this, start Netcat (nc) with the following command
>nc 192.168.168.200 5031 | | | +-- port 5031 = User Echo Port +----------- the DSP's IP address
Any characters you type in the console window will be returned. Netcat doesn't send the characters immediately, it will send the entire string following a terminating CR. Please note that the maximum length of the character string is limited by the size of the buffer used for TCP echo (MAX_DATA = 1024).
The user defined function 'init_parallel_echo_server()' must be called once to have at least one listening socket. After connecting this socket, the callback function tcp_echo() is called from TCP stack with error code SO_CONNECTION_ESTABLISHED. The next 'init_parallel_echo_server()' function call increases the server list. The new opened server socket is automatically in listening state and can be connected from the next client. After disconnecting one client, the TCP stack calls the user callback function again. This time with error code SO_CONNECTION_CLOSED (or SO_CONNECTION_RESET ). Call 'close_parallel_echo_server()' to decrease the server list and free all associated memory.