Home AMX User Forum AMX Technical Discussion

Apparently I forgot how to do Telnet connections

This works from the windows Telnet client, but I can't get it to work from AMX. I need to connect to this telnet server, and type anything + CR, LF.

I put these commands in some channel events and triggered the channel events:

IP_CLIENT_OPEN( dvPC1.Port, ip_PC1, port_PC1, IP_UDP );
Diagnostics output:
Line 10 (17:18:44):: CIpEvent::OnLine 0:6:1

SEND_STRING dvPC1, "'go',13,10"
Notifications output:
Line 15 (17:20:29):: String To [0:6:1]-[go$0D$0A]
The telnet server doesn't react to the string.


IP_CLIENT_CLOSE(dvPC1.PORT)
Diagnostics output:
Line 7 (17:18:14):: CIpEvent::OffLine 0:6:1

What am I forgetting?

Comments

  • PhreaKPhreaK Posts: 966
    From what I believe telnet is TCP based. Try:
    IP_CLIENT_OPEN( dvPC1.Port, ip_PC1, port_PC1, IP_TCP )
    
  • travistravis Posts: 180
    Doh!

    I haven't tried that yet, but I bet that's it. Thanks!

    Edit: Yes. that was it. Pay attention when you copy/paste code from other sections...
  • HedbergHedberg Posts: 671
    We had a thread about this about two years ago. Different Telnet servers may require different negotiation dialogs before they fully accept a connection and the connection can be used. There is a technote about telnet connections, but I think that it's wrong in stating that most telnet servers will accept connections without negotiation.

    Anyway, by watching traffic between a working server and client, it was possible to figure out how to work telnet. If you look at this thread http://www.amxforums.com/showthread.php?t=2702&highlight=telnet+ethereal" you'll understand what I'm talking about. In that thread there is a post by user Bob which has a data_event string handler which works for some telnet servers. There is also a sample string handler that I posted which works with a Windows XP Professional telnet server. Get yourself Wireshark (what ethereal is now called) and watch the communications if you have a different server.
  • travistravis Posts: 180
    Hedberg wrote: »
    We had a thread about this about two years ago. Different Telnet servers may require different negotiation dialogs before they fully accept a connection and the connection can be used. There is a technote about telnet connections, but I think that it's wrong in stating that most telnet servers will accept connections without negotiation.

    Anyway, by watching traffic between a working server and client, it was possible to figure out how to work telnet. If you look at this thread http://www.amxforums.com/showthread.php?t=2702&highlight=telnet+ethereal" you'll understand what I'm talking about. In that thread there is a post by user Bob which has a data_event string handler which works for some telnet servers. There is also a sample string handler that I posted which works with a Windows XP Professional telnet server. Get yourself Wireshark (what ethereal is now called) and watch the communications if you have a different server.
    I saw that thread a while ago. It saved me a lot of work on a Windows and a Linux server.
    This one is working now. Just needed to use TCP instead of UDP.
  • bobbob Posts: 296
    You can see here at that page the code for telnet to a windows, linux and apple box: http://www.amxforums.com/showthread.php?t=2702&page=2
    Have fun!
Sign In or Register to comment.