I have a small technical question on TCP connection:
My setup is the following :
RCM4300
Dynamic C 10.72E.
I’m using a TCP connection on TCP_PORT 23.
Today, I can only connect in tcp mode (e.g. telnet) in a single session.
Is it possible to have more parallel sessions available in TCP mode?
Yes, it is possible. Looking at Samples/tcpip/MULTI_ECHO.C, it appears that you can listen on multiple tcp_Socket structures by using the same port number for the tcp_listen() or tcp_extlisten() call.
My understanding of the sample code is that you end up with a pool of sockets, and the TCP/IP stack will assign new connections to the next listening socket that doesn’t already have a connection. If you follow that sample’s design, you’ll need an array for the sockets, and an array to keep track of the state of each socket. The socket’s state will determine whether it’s the start of a new connection, an existing connection that you need to poll for data, or a closed connection that you need to reopen.
Multiple calls to tcp_listen() to the same local port (lport) are acceptable and constitute the mechanism for supporting multiple incoming connections to the same local port. Each time another host attempts to open a session on that particular port, another one of the listens will be consumed until such time as all listens have become established sessions and subsequent remote host attempts will receive a reset.
Hello Tom,
The sample muti_echo.c is working well.
It was complicated to integrate it into our software, but it works quite well.
Thanks a lot
Best regards,