Telnet tutorial
flcusat
Posts: 309
Is there any tutorial available in how to use Telnet?
0
Comments
Unless of course you're asking about how to program the processor to "talk" via telnet with something.
http://www.scit.wlv.ac.uk/~jphb/comms/telnet.html
Also, in addition to 'help' you can also type '?'
Jeremiah: When I type help in the telnet session these are the parameters that I get.
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?
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?
or "open ip address" add a space and port # if not 23.
when I type superuser I get invalid command.
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 "
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?)
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
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
send_command dFred,'Yo'
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'
<=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.
I've been going to Run>cmd (ok)
Then Then
as opposed just doing:
Run>cmd (ok)
Then
Just another reason it seems everything I do just takes longer that it should!
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.
Herbeg, It didn't work for me. Here is an screenshot of what I tried.
but when I tried to simulate a device wih the same D:S:P they worked.
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.
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.