RCM4300 and nb of TCP connections

Hello,

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?

Thanks,
Fabrice

1 Like

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.

From the Dynamic C TCP/IP User’s Manual, Volume 1:

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.

1 Like

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,