1

Last question I asked can be found in below link related to the same problem,

How to implement tab completion on the telnet client side

but now as I started implementing taking the inputs from the answers I got, I am facing some more issues. Let me put my code snippet

send(tClntSockFd, "377/375/042/377/373/001", 6, 0));    
while(lineIndex < CMD_MAX_LEN)    {    
/* Receive from the client */        
  if (RHU_FAILURE == (numbytes = recv(tClntSockFd,usrCommand, CMD_MAX_LEN, 0))) {
    RHU_LOG1(RHU_CM_CLI, RHU_LOG_ERROR, "recv error");
    exit(1);
  }
  if('\t' == usrCommand[lineIndex])    {    
    printf("tab comp req\n");
    break;
  }
  lineIndex++;
}    

I know I am not doing it right, but I dont know what is right method, initially I set the telnet into character mode, later I receive characters from the socket, then I am trying handle whenever tab is pressed. The problem is I am not able capture tab, I only get \r and \n at the end.

How to capture tab or any method which would answer my question? Thanks in advance.

Community
  • 1
  • 1
Puneeth
  • 419
  • 1
  • 6
  • 18
  • I suppose that lineIndex has been initialized with 0s right? – Abend Feb 05 '14 at 06:58
  • Yes Abden, problem is when I press tab it is not sending tab character but it send \r and \n character if I press enter. – Puneeth Feb 05 '14 at 07:05
  • Did you check that the tab character is not interpreted as a series of spaces? Some servers have not implemented the tab character and do this with it. – Abend Feb 05 '14 at 07:42
  • No Abend it is not, I checked each index of usrCommand. Am I setting the telnet to character mode correctly? If so why telnet not capturing tab character? Are there any extra settings need to be done? Any masking required? – Puneeth Feb 06 '14 at 07:16
  • Take a look to this: http://pcmicro.com/netfoss/telnet.html You have a couple of setting about horizontal tab. Perhaps some settings are not set properly in your server. – Abend Feb 06 '14 at 18:48

0 Answers0