Fix for slow telnet on 4.1 ( Windows )

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Fix for slow telnet on 4.1 ( Windows )

1,064 Views
gpontis
Contributor IV

This subject has been discussed several times for earlier releases of MQX, but I never saw a clear-cut fix. My 4.1 app supports a telnet interface but was painfully slow. The fix was to modify the rtcs library slightly to disable the Nagle algorithm for the Telnet server. In the RTCS project, under apps, edit the file telnsrv.c. Around line 280 add the code to change this option:

   // Disable nagle algorithm for much faster performance with Windows clients

   option = 1;  

   error = setsockopt(telnetsrv_context.LISTENSOCK, SOL_TCP, OPT_NO_NAGLE_ALGORITHM, &option, sizeof(option));

   if (error) {

      RTCS_task_exit(creator, error);

   }

George

Labels (1)
1 Reply

627 Views
matthewkendall
Contributor V

A while ago I did very much the same thing, but I made it an option rather than hard-coding it off. I added this to user_config.h

#define TELNETDCFG_NO_NAGLE_ALGORITHM            1

Then in telnsrv.c, in TELNETSRV_task() at the beginning where the options are being set up, I added:

   option = TELNETDCFG_NO_NAGLE_ALGORITHM;

   error = setsockopt(telnetsrv_context.LISTENSOCK, SOL_TCP, OPT_NO_NAGLE_ALGORITHM, &option, sizeof(option));

   if (error) {

      RTCS_task_exit(creator, error);

   }

To provide a default, add the following to rtcscfg.h:

/*

** MGCT: <option type="bool"/>

*/

#ifndef TELNETDCFG_NO_NAGLE_ALGORITHM

   #define TELNETDCFG_NO_NAGLE_ALGORITHM 0

#endif

I believe that also has the effect of making the option show up in the GUI editor for user_config.h on the RTCS tab.