C++ – Telnet client console: SEND invalid command – Only for Spanish version

cqtsocketstelnetwindows-xp

I’ve developed an application in QT C++ (server with listening sockets) waiting for clients to connect and send commands.

It was developed and tested in Windows XP Professional Version 2002 SP3 English version and tested in Windows seven 64 bits using telnet client sending strings to server from command prompt using reserved word SEND without problems.

Actually I am testing this app from another Windows XP Professional Version 2002 SP3 Spanish version machine and I’m having problems with sending strings.

Telnet client connects correctly, receives data from server, but when I move to command prompt and try to send strings I receive and error.

Microsoft Telnet> send MYSTRING

Invalid command. type ?/help for help

Microsoft Telnet> ?

Commands may be abbreviated. Supported commands are:

c – close close current connection

d – display display operating parameters

o – open hostname [port] connect to hostname (default port 23).

q – quit exit telnet

set – set set options (type ‘set ?’ for a list)

sen – send send strings to server

st – status print status information

u – unset unset options (type ‘unset ?’ for a list)

?/h – help print help information

Microsoft Telnet> d

Escape Character is ‘CTRL+}’

Will auth(NTLM Authentication)

Local echo off

New line mode – Causes return key to send CR & LF

Current mode: Console

Will term type

Preferred term type is ANSI

Note: Above transcription is translated, I get this message in Spanish

I need to know if this problem, telnet not recognizing a reserved word is a configuration or security problem.

Windows Firewall is deactivated.

EDIT1:

To clear situation on problem with Telnet Client:

I develop an App in Windows XP 2002 SP3 English version. This app is a server in a network listening in port 6000. Waits for clients to connect (through Telnet client for example) over lan.

The pc running my app has IP1 and its working.

From PC2 with same os I connect using >telnet IP1 6000 and after I connect and receive data from my app (server). Then I press 'ctrl+}' and get to Telnet prompt Microsoft Telnet> send AnyString AnyString has been sent to server. My app receives data correctly, process it and works fine.

From PC3 using W7 and Ubuntu virtual machines, same procedure than PC2 and it works fine.

From PC4 os Windows XP SP3 2002 Spanish i connect using >telnet IP1 6000 and after I connect and receive data from my app (server). Then I press 'ctrl+}' and get to Telnet prompt Microsoft Telnet> send AnyString Invalid command. type ?/help for help

That's why I suppose Telnet client on XP can be "configured?"

Best Answer

To send a text message over TCP/IP using telnet client you need just to call telnet with address (and port if not default 23 should be used), i.e:

> telnet 192.168.1.1 13   // tell me your time
> string to be sent       // type windows's enter
>                         // should be sent as a text to 192.168.1.1 on port 13

when i move to command prompt and try to send strings i receive and error.

Microsoft Telnet> send MYSTRING

Invalid command. type ?/help for help

The command is named sen, not send. Maybe a send is also sen but in help only sen is showed so better stick with it.

You can move to telnet mode by typing escape character that might be i.e. '^]' then type sen:

> telnet 192.168.1.1 13
> ctrl+]
Microsoft Telnet> sen my string here
>                         // should be sent as a text to 192.168.1.1 on port 13

Microsoft telnet client sen command terminates strings with null: when you type 5 characters p i o t r it terminates these 5 bytes with 00 byte ( '\0') so there are 6 bytes sent:

p  i  o  t  r  .
70 69 6f 74 72 00

In case of problems with Microsoft Telnet you can always install a putty or write a simple telnet client:

void
str_cli(FILE *fp, int sockfd) {
    char buf[MAXLINE];
    int n;

    for ( ;;) {
        if ((n = Read(fileno(fp), buf, MAXLINE)) < 0) {
            err_quit("str_cli:");
        }  
        Writen( sockfd, buf, n);
    }
}

int main( int argc, char** argv) {
    int         sockfd;
    struct sockaddr_in  servaddr;

    if (argc != 2)
        err_quit("usage: tcpcli <IPaddress>");

    sockfd = Socket(AF_INET, SOCK_STREAM, 0);
    bzero(&servaddr, sizeof(servaddr));
    servaddr.sin_family = AF_INET;
    servaddr.sin_port = htons( SERV_PORT);
    Inet_pton(AF_INET, argv[1], &servaddr.sin_addr);

    Connect(sockfd, (SA *) &servaddr, sizeof(servaddr));

    str_cli( stdin, sockfd);        /* do it all */

    close( sockfd);

    exit(0);
}
Related Topic