Author Topic: Multiple telnet connections  (Read 8849 times)

Offline alager

  • Jr. Member
  • **
  • Posts: 92
    • View Profile
Multiple telnet connections
« on: May 22, 2009, 10:42:16 PM »
I'm trying to get multiple telnet connections into to the telnet server, but uTasker is only allowing 1.
The second client sends the [SYN], and the server responds with [RST][ACK].
I have NO_OF_TELNET_SESSIONS   3
and USER_TCP_SOCKETS      3

I have one automated telnet client in the uTasker project that is calling out every 10 seconds.
And I need to let two clients call into the device.

With one client connected my heap and stack are:
HEAP   Free 0x0c9c from 0x6400
STACK   Unused 0x09cb
Which should be plenty to allow the second incomming session.

What else do I need to check?

Thanks,
Aaron

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3236
    • View Profile
    • uTasker
Re: Multiple telnet connections
« Reply #1 on: May 23, 2009, 01:22:27 AM »
Hi Aaron

The TELNET interface (in debug.c) in the demo project is a single user interface and therefore any second attempt will be refused.
The TELNET interface is however based on the TELNET server which can have multiple sessions running (up to NO_OF_TELNET_SESSIONS).

This means that you can extend the application interface to also handle multiple sessions/users if needed (this is an application thing and not a server thing). This can however be a little more complicated due to the fact that each session will need also its own set of resources (eg. if the input data is being collected to a buffer you will need two buffers to collect input from 2 users at the same time) and the application behind will need to know which set of session data to respond to, where to and possibly also send some things to all open connections.

Therefore I think that there shouldn't be a big problem to do it but it does require the demo application/Telnet interface to be extended to suit the specific project requirements.

regards

Mark



Offline alager

  • Jr. Member
  • **
  • Posts: 92
    • View Profile
Re: Multiple telnet connections
« Reply #2 on: May 26, 2009, 04:16:00 PM »
Mark,

Okay, thanks for the info about needing to duplicate the buffers and what not.  Can you point me to the mechanism that is causing the connection to be refused?  I'm sure there is a flag somewhere, I just haven't been able to locate it.

Thanks,
Aaron

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3236
    • View Profile
    • uTasker
Re: Multiple telnet connections
« Reply #3 on: May 26, 2009, 04:51:24 PM »
Hi Aaron

Any TCP connection attempt to a non-listening TCP socket will result in a refused connection.

In your particular case (the single TELNET socket already being in use) it takes place at TCP.c -> fnMapTCPSocket(). Here all TCP sockets on the TELNET port will be searched for and their state checked against TCP_STATE_LISTEN. A socket will be found but its state will not allow it to accept the connection request.

The first thing that you need to do is declare a second TELNET socket so that a free one will be able to be identified.

Regards

Mark