Home AMX User Forum AMX General Discussion

Telnet tutorial

Is there any tutorial available in how to use Telnet?
«1

Comments

  • jjamesjjames Posts: 2,908
    Try this command:
    help
    
    It brings up a huge list of commands available to use in telnet.

    Unless of course you're asking about how to program the processor to "talk" via telnet with something.
  • ericmedleyericmedley Posts: 4,177
    If you're looking for the protocol, here's a link. You can search Google for 'telent protocol' and get more help than you'll ever need.

    http://www.scit.wlv.ac.uk/~jphb/comms/telnet.html

    Also, in addition to 'help' you can also type '?'
  • flcusatflcusat Posts: 309
    jjames wrote:
    Try this command:
    help
    
    It brings up a huge list of commands available to use in telnet.

    Unless of course you're asking about how to program the processor to "talk" via telnet with something.


    Jeremiah: When I type help in the telnet session these are the parameters that I get.
    c-close
    d-display
    o-open hostname (port)
    q-quit
    set-set
    sen-send
    st-status
    u-unset
    ?/-help
    
    

    Let's say that I want to send a command to a device in my system and see what is the response that this device sends back to the controller. How do I achieved that with telnet?
  • DHawthorneDHawthorne Posts: 4,584
    There isn't really much to Telnet. The complexity arises with the device you are connected to.
  • flcusatflcusat Posts: 309
    DHawthorne wrote:
    There isn't really much to Telnet. The complexity arises with the device you are connected to.

    Dave, I was trying to play with telnet to control my receiver at home; if I send a command to power on the receiver. I'm sending the following:

    send_command vdvNAD_773, "'POWER=1:1'"

    Which is the same command I send in NS but it tells me that is an invalid command in Telnet. What am I missing?
  • viningvining Posts: 4,368
    When in telnet type "o ip address" add a space and port # if not 23.
    or "open ip address" add a space and port # if not 23.
  • viningvining Posts: 4,368
    flcusat wrote:
    Which is the same command I send in NS but it tells me that is an invalid command in Telnet. What am I missing?
    Did you actually connect to the master and log in first?
  • flcusatflcusat Posts: 309
    Vinning, No, I didn't. That's exactly the kind of information I was refering to. Telnet was mentioned in both Installer and Programmer I classes that I took but never was implemented. I looked through my class books and notes and I didn't find anything useful in how actually use telnet. A search on the AMX web site was also not useful. So here I'm trying to learn how to use something without any reference where I could look at. You guys here are the best resource I can count on to learn.
  • flcusatflcusat Posts: 309
    Connecting to the Master with o and the master's IP address and then sending the command worked, but how do I get the response back from the device to display?
  • Thomas HayesThomas Hayes Posts: 1,164
    If you type 'superuser' than 'help' you should get more options.
  • viningvining Posts: 4,368
    I've never done this but if you you type "msg on" while in the master telnet you should get all the debug feedback you would normally see from a send_string 0. This of course requires your code to have these send_string 0 to begin with and if it requires a nDeBug variable of some name set to permit these messages then that needs to be set as well.
  • viningvining Posts: 4,368
    OK, I just tried "msg on" after setting some debug variable to on and it works fine. I'm not sure why I would want to do it this way as opposed to just using NS2 but it's a viable option.
  • flcusatflcusat Posts: 309
    If you type 'superuser' than 'help' you should get more options.

    when I type superuser I get invalid command.
  • ericmedleyericmedley Posts: 4,177
    flcusat wrote:
    Dave, I was trying to play with telnet to control my receiver at home; if I send a command to power on the receiver. I'm sending the following:

    send_command vdvNAD_773, "'POWER=1:1'"

    Which is the same command I send in NS but it tells me that is an invalid command in Telnet. What am I missing?

    I think you need to put in the raw device : port : system address instead of the meta-name

    so if, for example

    vdvNAD_773 = 33001:01:0


    Then the command will be

    send command 33001:01:0, " 'POWER=1:1' "

    (Also, when in Telnet you don't need to put the underscore '_' between send and command

    Try that

    If your protocol requires a <cr><lf> you'll need to ad that too.

    send command 33001:01:0, " 'POWER=1:1',$0d,$0a "
  • Thomas HayesThomas Hayes Posts: 1,164
    flcusat wrote:
    when I type superuser I get invalid command.

    I just tried it with a NI-700 that's sitting on my desk, seemed to work for me.
  • ericmedleyericmedley Posts: 4,177
    I just tried it with a NI-700 that's sitting on my desk, seemed to work for me.

    I've had rather hit and miss results on this issue too. I just happen to know most of the commands in SU mode, so I don't need to login per se to see the help list.

    but, I have found some masters that don't seem to work the same as others. (Firmware version?)
  • NMarkRobertsNMarkRoberts Posts: 455
    Attempt to summarise and add some hints and tricks

    What an entertaining thread, I guess we don't know what we don't know, me included!

    Here is my attempt at the Telnet tutorial that ficusat asked for:

    Telnet is a commonly used method of using IP so that a person at a keyboard can talk to something on the other side of a network.

    In the context of AMX programming, this usually means setting up a telnet session from a PC to a NetLinx master in order to do housekeeping on the master, to experiment, or to monitor debug messages generated by code on the master.

    To establish a telnet session, connect both your PC and the master to the network and assign static IP addresses to both (optional but best).

    Now run the cmd line. Click on Start / Run and type in

    cmd<enter>

    On older machines you may need

    command<enter>

    You should see a black window. This is the DOS command line of your PC. Yes, you still have DOS in there. Don't know what DOS is? Google can help!

    If you want to avoid that palaver above, find cmd.exe in your Windows system folder and drag a shortcut to your desktop.

    Enter the following command:

    telnet <IP address of master><enter>

    eg

    telnet 192.168.0.100<enter>

    and you should immediately connect.

    Note that this works but is a bit crappy - window sizing is very annoying. A decent telnet client would be better - can anyone recommend one?

    To make that easier next time, make a DOS batch file. First note the directory in which your DOS box opens. Now use a text editor to create a simple text file in that directory called "a.bat" with contents "telnet 192.168.0.100". Now to connect from the DOS box just type in

    a<enter>

    To send debug messages from code, the code should contain lines like
    send_string 0,'This just happened'
    

    To see those messages in your telnet session, type in

    msg on<enter>

    You almost always want to do this but I haven't worked out an automated way to do it yet. I guess it would be easy to script in a decent telnet client.

    To see what else you can do in the telnet session, type in

    help<enter>

    If you want MORE POWERFUL STUFF type in

    superuser<enter>
    help<enter>

    and gosh what dangerous stuff you can do!

    Now try sending a string:

    send_string 5001:1:1,'Hello'

    and watch the 1st serial port led flash.

    To send a command to a virtual device, try

    send_command 33001:1:0,'Hi'

    or

    send command 33001:1:0,'Hi'

    You can refer to a device by its code name
    program_name='Fred'
    
    define_device
    
    dFred = 33001:1:0
    

    send_command dFred,'Yo'
  • viningvining Posts: 4,368
    NMarkRoberts wrote:
    Telnet 192.168.0.100<enter>
    How do you get that to work w/o "o" before the IP address. Everything else was right on the mark!

    Welcome to Microsoft Telnet Client

    Escape Character is 'CTRL+]'

    Microsoft Telnet> o 192.168.1.60 (hit enter key)
    or

    Welcome to Microsoft Telnet Client

    Escape Character is 'CTRL+]'

    Microsoft Telnet> open 192.168.1.60 (hit enter key)
    Replace 192.168.1.60 with the IP of your master.
  • joelwjoelw Posts: 175
    send_string 5001:1:1,'Hello'
    send string 5001:1:1,'Hello'

    send_command 33001:1:0,'Hi'
    send command 33001:1:0,'Hi'

    This also works:
    send c
    send s

    So any of the following:
    send_string 5001:1:1,'Hello'
    send string 5001:1:1,'Hello'
    send s 5001:1:1,'Hello'

    send_command 33001:1:0,'Hi'
    send command 33001:1:0,'Hi'
    send c 33001:1:0,'Hi'
  • joelwjoelw Posts: 175
    vining wrote:
    NMarkRoberts wrote:

    How do you get that to work w/o "o" before the IP address. Everything else was right on the mark!

    <=WinXP: Start, Run, Open, type "telnet 192.168.1.5", hit Enter
    Replace 192.168.1.5 with the IP address of your controller.

    When the far end disconnects the Telnet window goes away.

    This is what I do when testing.
  • viningvining Posts: 4,368
    Ok, that works from the cmd DOS page and I usually go from cmd to the telnet DOS page where you need the "o".

    I've been going to Run>cmd (ok)
    Then

    Microsoft Windows XP [Version 5.1.2600]
    (C) Copyright 1985-2001 Microsoft Corp.

    C:\Documents and Settings\DVining>telnet (type telnet then enter)
    Then

    Welcome to Microsoft Telnet Client

    Escape Character is 'CTRL+]'

    Microsoft Telnet> o 192.168.1.60 (hit enter key)

    as opposed just doing:

    Run>cmd (ok)
    Then

    Microsoft Windows XP [Version 5.1.2600]
    (C) Copyright 1985-2001 Microsoft Corp.

    C:\Documents and Settings\DVining>telnet 192.168.1.60 (then enter)

    Just another reason it seems everything I do just takes longer that it should!
  • flcusatflcusat Posts: 309
    Thanks guys. Very informative.
  • DHawthorneDHawthorne Posts: 4,584
    I vastly prefer using Hyperterminal for Telnet; I have the Private edition, not the one packaged with Windows. It allows me far more customization, text capture, and as many stored setups as I care to make.
  • flcusatflcusat Posts: 309
    Another question. How can I simulate a push button in a touch panel? I'm sending this:
    pulse[10001:5:1,5]
    
    

    but there is not action executed.
  • HedbergHedberg Posts: 671
    try "do_push()"
    flcusat wrote:
    Another question. How can I simulate a push button in a touch panel? I'm sending this:
    pulse[10001:5:1,5]
    
    

    but there is not action executed.


    do_push(dvpanel,nbtn). Note that this is one of the very few (maybe three) occasions when a device.channel pair is not enclosed in square brackets.

    When I took the programmer courses, someone told me that using do_push could be dangerous, but the reason was not explained and I don't remember who it was.

    Personally, I find do_push rather useful from time to time.

    BTW, the default do_push press time is .5 seconds. You can use do_push_timed or do_push_timed_infinite for other press times.

    A friend, who is the most experienced and accomplished AMX programmer I know, suggested that do_push is dangerous because it wouldn't work if the panel device was not online. I didn't think that was my experience, so I tested the question and it seems to me that the panel referred to in the do_push statement does not need to be online -- or even exist. You can use do_push with an imaginary panel so long as it's defined in define_device. Doesn't even need to be a virtual device.

    That's what I saw with an NI700 -- I suspect it may be different for Access programming.
  • flcusatflcusat Posts: 309
    Hedberg wrote:
    do_push(dvpanel,nbtn). Note that this is one of the very few (maybe three) occasions when a device.channel pair is not enclosed in square brackets.
    .

    Herbeg, It didn't work for me. Here is an screenshot of what I tried.
  • flcusatflcusat Posts: 309
    And here a list of available functions. do_push is not listed here.
  • flcusatflcusat Posts: 309
    Now, There is an On and Off command. But if tried to use them like:
    on[10001:5:1,1]
    
    

    but when I tried to simulate a device wih the same D:S:P they worked.
  • HedbergHedberg Posts: 671
    do_push() doesn't work in terminal/telnet

    Sorry, I misunderstood what you were asking. do_push works in code, but is not a valid command via telnet, nor rs232 through the programming port(I don't hink it is, anyway). I suppose that in a discussion dedicated to the telnet dialog, I should have realized.

    I don't know how to simulate a button press from telnet. If I want to do it while trouble shooting or experimenting, I use the emulate device functionality in Netlinx Studio diagnostics.

    When you pulse a touch panel channel (or turn one on or off) from telnet, you're manipulating touch panel feedback.
  • NMarkRobertsNMarkRoberts Posts: 455
    pulse is for the outgoing channel

    do_push is for the incoming channel - but it doesn't work, nor do any of the alternatives I tried.

    How about if you attach a touchpanel and use that. Make up a tpd with channel 1..255 and assign it to a device number you don't otherwise use.
Sign In or Register to comment.