IP Ping
-
- Aurora
- Posts: 868
- Joined: Tue Dec 17, 2013 1:17 pm
IP Ping
I've written a small utility for QPC2 that allows you to 'ping' another PC (or the the one you are working on) and get a response from up to 10 QPC2's that are running the 'ping server' on that PC.
Before I stamp a V1.00 on it, and call it done. I would appreciate any feedback or suggestions for improvements.
Is the maximum length of the response OK?
Should you only be able to have one ping server running on a copy of QPC2 at any one time?
Before I stamp a V1.00 on it, and call it done. I would appreciate any feedback or suggestions for improvements.
Is the maximum length of the response OK?
Should you only be able to have one ping server running on a copy of QPC2 at any one time?
- Attachments
-
- IP_Ping.zip
- (85.79 KiB) Downloaded 229 times
Re: IP Ping
I've tested this with SMSQmulator 2.24, using only the local system and it worked. I did the PSERVE command and then the Ping command and got back the string that I entered in PSERVE.
What about making a more normal version of PING where you ping an IP address (ICMP request) and see if you get a response? If you are creating a PING command that really does not work like a normal PING, then I would suggest changing the name of the command to something like QPING to distinguish it from the normal PING command.
Tim Swenson
What about making a more normal version of PING where you ping an IP address (ICMP request) and see if you get a response? If you are creating a PING command that really does not work like a normal PING, then I would suggest changing the name of the command to something like QPING to distinguish it from the normal PING command.
Tim Swenson
- Giorgio Garabello
- Gold Card
- Posts: 277
- Joined: Tue Jun 30, 2015 8:39 am
- Location: Turin, Italy
- Contact:
Re: IP Ping
Tried on my network and works perfectly.Martin_Head wrote:I've written a small utility for QPC2 that allows you to 'ping' another PC (or the the one you are working on) and get a response from up to 10 QPC2's that are running the 'ping server' on that PC.
Before I stamp a V1.00 on it, and call it done. I would appreciate any feedback or suggestions for improvements.
Is the maximum length of the response OK?
Should you only be able to have one ping server running on a copy of QPC2 at any one time?
I only have a doubt if the computer responds correctly to the first attempt, why do the other nine?
Giorgio
- QLvsJAGUAR
- Gold Card
- Posts: 471
- Joined: Tue Feb 15, 2011 8:42 am
- Location: Lucerne, Switzerland
- Contact:
Re: IP Ping
Good stuff.Martin_Head wrote:Before I stamp a V1.00 on it, and call it done. I would appreciate any feedback or suggestions for improvements.
Is the maximum length of the response OK?
Should you only be able to have one ping server running on a copy of QPC2 at any one time?
I would like to see it as part of the IPNet /LocalIPNet drivers or the IPBASIC toolkit rather than another stand-alone binary.
I would go for a limit of one Ping Server instance per “QL”.
The free string for Ping Server is somewhat nice, but what about 100% Windows/Linux type output of PING?
Keep on going the good work!
Cheers,
Urs
QL forever!
https://www.sinclairql.net/ - Go and get THE DISTRIBUTION & QL/E!
https://www.youtube.com/QLvsJAGUAR/community - Blog
https://www.youtube.com/QLvsJAGUAR - Dedicated QL videos
Sinclair, QL, ATARI, JAGUAR, NUON, APPLE, NeXT, MiST & much more...
Videos, pictures & information
https://www.sinclairql.net/ - Go and get THE DISTRIBUTION & QL/E!
https://www.youtube.com/QLvsJAGUAR/community - Blog
https://www.youtube.com/QLvsJAGUAR - Dedicated QL videos
Sinclair, QL, ATARI, JAGUAR, NUON, APPLE, NeXT, MiST & much more...
Videos, pictures & information
-
- Aurora
- Posts: 868
- Joined: Tue Dec 17, 2013 1:17 pm
Re: IP Ping
I'm no expert on networks, and I don't know how the normal 'DOS' ping commands works, or if it possible to to do it in the QDOS IP Device driver.swensont wrote:What about making a more normal version of PING where you ping an IP address (ICMP request) and see if you get a response? If you are creating a PING command that really does not work like a normal PING, then I would suggest changing the name of the command to something like QPING to distinguish it from the normal PING command.
I was originally going to call it IP_PING, I can easily go back to that. I could always call it QPING, but it's always bugged be a bit how just about anything to do with the QL gets a 'Q' stuck in front of it.
The PING command does not know how many Ping Servers/emulators are running on the PC you are PINGing (you can get multiple responses). So It checks all 10, and gives you a 'No server' response for the ones it did not find. I could just return an empty response (with or without a line feed at the end) from missing servers, but you could be sitting there for up to 30 seconds thinking 'what's happening?' as nothing may be appearing on the screen.Giorgio Garabello wrote:Tried on my network and works perfectly.
I only have a doubt if the computer responds correctly to the first attempt, why do the other nine?]
When you start a Ping Server, it scans the port range it can use, and picks the first unused one. So if you start eight Ping Servers, then remove the first seven of them. Then do a PING, you will get back something like
** No server found **
** No server found **
** No server found **
** No server found **
** No server found **
** No server found **
** No server found **
Your message
** No server found **
** No server found **
If you did not have a 'no server found' message, you would sit there for about 20 seconds seeing nothing, until Your message appeared. But if this change is wanted please say.
I may incorporate it into IPNet/LocalNet/IP_BASIC when I'm/everyone's happy with the way it works.QLvsJAGUAR wrote:I would like to see it as part of the IPNet /LocalIPNet drivers or the IPBASIC toolkit rather than another stand-alone binary.
I would go for a limit of one Ping Server instance per “QL”.
The free string for Ping Server is somewhat nice, but what about 100% Windows/Linux type output of PING?
I was going to limit it to one Ping Server per 'QL', But I thought someone might want to have more than one message available. For example you might want to have a program running on an emulator (foreground or background task) that either supplies a message that it has finished what it was doing, or sends a message that it is busy doing something.
What's the general view?
As to a 100% Windows/Linux type output, As I said above I don't know how the normal Ping commands works, or if it possible to to do it in the QDOS IP Device driver.
Martin
- Giorgio Garabello
- Gold Card
- Posts: 277
- Joined: Tue Jun 30, 2015 8:39 am
- Location: Turin, Italy
- Contact:
Re: IP Ping
Martin_Head wrote:I'm no expert on networks, and I don't know how the normal 'DOS' ping commands works, or if it possible to to do it in the QDOS IP Device driver.swensont wrote:What about making a more normal version of PING where you ping an IP address (ICMP request) and see if you get a response? If you are creating a PING command that really does not work like a normal PING, then I would suggest changing the name of the command to something like QPING to distinguish it from the normal PING command.
I was originally going to call it IP_PING, I can easily go back to that. I could always call it QPING, but it's always bugged be a bit how just about anything to do with the QL gets a 'Q' stuck in front of it.
The PING command does not know how many Ping Servers/emulators are running on the PC you are PINGing (you can get multiple responses). So It checks all 10, and gives you a 'No server' response for the ones it did not find. I could just return an empty response (with or without a line feed at the end) from missing servers, but you could be sitting there for up to 30 seconds thinking 'what's happening?' as nothing may be appearing on the screen.Giorgio Garabello wrote:Tried on my network and works perfectly.
I only have a doubt if the computer responds correctly to the first attempt, why do the other nine?]
When you start a Ping Server, it scans the port range it can use, and picks the first unused one. So if you start eight Ping Servers, then remove the first seven of them. Then do a PING, you will get back something like
** No server found **
** No server found **
** No server found **
** No server found **
** No server found **
** No server found **
** No server found **
Your message
** No server found **
** No server found **
If you did not have a 'no server found' message, you would sit there for about 20 seconds seeing nothing, until Your message appeared. But if this change is wanted please say.
I may incorporate it into IPNet/LocalNet/IP_BASIC when I'm/everyone's happy with the way it works.QLvsJAGUAR wrote:I would like to see it as part of the IPNet /LocalIPNet drivers or the IPBASIC toolkit rather than another stand-alone binary.
I would go for a limit of one Ping Server instance per “QL”.
The free string for Ping Server is somewhat nice, but what about 100% Windows/Linux type output of PING?
I was going to limit it to one Ping Server per 'QL', But I thought someone might want to have more than one message available. For example you might want to have a program running on an emulator (foreground or background task) that either supplies a message that it has finished what it was doing, or sends a message that it is busy doing something.
What's the general view?
As to a 100% Windows/Linux type output, As I said above I don't know how the normal Ping commands works, or if it possible to to do it in the QDOS IP Device driver.
Martin
It depends on the use you want to make the ping command.
Surely for your example, your solution is optimized.
But let's say you want to write a program that scans the network looking for QL emulators (which obviously have to have all Ping Server enabled.)
It would serve something like that.
PING "192.168.1.1"
PING "192.168.1.2"
PING "192.168.1.3"
PING "192.168.1.4"
PING "192.168.1.5"
PING "192.168.1.6"
PING "192.168.1.7"
PING "192.168.1.8"
PING "192.168.1.9"
PING "192.168.1.10"
.......
PING "192.168.1.255"
In this case, in the current form, the ping command is too slow to look for 2550 QL
Perhaps you can enter the maximum number of servers to search for as an additional parameter, or create two separate commands.
In my opinion, "localnet" is very interesting to do tests but for practical use (work, hobby) it's enough to have only one QL emulated for each PC but my needs may be different from those of other users.
Quantum Technology
http://www.hunggartorino.it/ql/language/en/
http://www.hunggartorino.it/ql/language/en/
-
- Aurora
- Posts: 868
- Joined: Tue Dec 17, 2013 1:17 pm
Re: IP Ping
Yes I know speed is an issue. This go back a little while, to where I was having a discussion with someone else here on the Forum about having a network of multiple PC's running multiple emulators and trying to determine which network station was on which PC. And how you would know if a network station disappeared, or a new one was added. We never came to a good solution, as scanning the network would be too slow.Giorgio Garabello wrote:But let's say you want to write a program that scans the network looking for QL emulators (which obviously have to have all Ping Server enabled.)
It would serve something like that.
PING "192.168.1.1"
PING "192.168.1.2"
PING "192.168.1.3"
PING "192.168.1.4"
PING "192.168.1.5"
PING "192.168.1.6"
PING "192.168.1.7"
PING "192.168.1.8"
PING "192.168.1.9"
PING "192.168.1.10"
.......
PING "192.168.1.255"
In this case, in the current form, the ping command is too slow to look for 2550 QL
Something I noticed while testing PING, is that it seemed to return immediately from a ping, if I PINGed the IP Address of a non existent PC. Now I don't know if that was just a fluke, but if you do 255 pings, it may be quicker than you think. This was something I was going to look into, If I can figure out a way of detecting that the ping had come straight back from the first test. I could skip the other 9 tests, and display a missing computer report.
That was the idea with IPNet, but someone asked if you could have a network with multiple emulators on one PC, and thats where IPLocalNet came from.In my opinion, "localnet" is very interesting to do tests but for practical use (work, hobby) it's enough to have only one QL emulated for each PC but my needs may be different from those of other users.
Re: IP Ping
The stack often knows if there's !H (no host) so it can return very quickly.
You can also from the PC side use Angry IP Scanner.
Some networks may interpret a large number of pings in a short time as either an attack or an infection. Best to keep it within your own private subnet.
You can also from the PC side use Angry IP Scanner.
Some networks may interpret a large number of pings in a short time as either an attack or an infection. Best to keep it within your own private subnet.
-
- Aurora
- Posts: 868
- Joined: Tue Dec 17, 2013 1:17 pm
Re: IP Ping
I was looking into writing a more normal type of PING. But I don't think it's possible with the IP Device driver. It only lets you open IP sockets on the host system, not the ICMP ones you would want.
So I tried coming from another angle.
This program creates a DOS batch file on one of QPC2's 'dos' devices (dos3_ in this case). Then makes Windows run the batch file. Then reads the output of the batch file.
In line 120, You set the Windows path to your 'dos' device. If you don't have ENV_BIN, you could just make this a string.
Here's some extra code that adds the IPCONFIG command.
The above is not perfect, it's just a proof of concept. It would be better if it was a Function that returned a string, rather than a Procedure. So you could analyse the returned results in a program.
You could probably make it handle more generic DOS commands, like, PRINT DOS_CMD("dir c:\") to get a dos directory of the C: drive.
As for my IP PING program, I think I will rename the PING command as IP_PING and release it.
Martin
So I tried coming from another angle.
Code: Select all
100 REMark Call the PING command from QPC2
110 :
120 SETENV "BATCH=d:\qpc dos drives\dos3\"
130 STOP
200 PING "127.0.0.1"
400 :
410 :
1000 DEFine PROCedure PING (ip_addr$)
1010 LOCal ch,loop,a$,path$
1020 path$=GETENV$("BATCH")
1030 ch=FOP_OVER("dos3_ping.bat")
1040 PRINT#ch,'ECHO OFF'&CHR$(13)
1050 PRINT#ch,"C:"&CHR$(13)
1060 PRINT#ch,'PING ';ip_addr$;'>"'&path$&'output.txt"'&CHR$(13)
1070 CLOSE#ch
1080 QPC_EXEC path$&'ping.bat'
1090 REMark Now read the result
1100 REPeat loop
1110 ch=FOP_IN("dos3_output.txt")
1120 IF ch>0 THEN EXIT loop
1130 END REPeat loop
1140 REPeat loop
1150 IF EOF(#3) THEN EXIT loop
1160 a$=INKEY$(#3)
1170 IF CODE(a$)=13 THEN NEXT loop
1180 PRINT a$;
1190 END REPeat loop
1200 CLOSE#ch
1210 DELETE "dos3_output.txt"
1220 DELETE "dos3_ping.bat"
1230 END DEFine PING
In line 120, You set the Windows path to your 'dos' device. If you don't have ENV_BIN, you could just make this a string.
Code: Select all
210 IPCONFIG
2000 DEFine PROCedure IPCONFIG
2010 LOCal ch,loop,a$,path$
2020 path$=GETENV$("BATCH")
2030 ch=FOP_OVER("dos3_ipconfig.bat")
2040 PRINT#ch,'ECHO OFF'&CHR$(13)
2050 PRINT#ch,"C:"&CHR$(13)
2060 PRINT#ch,'IPCONFIG>"'&path$&'output.txt"'&CHR$(13)
2070 CLOSE#ch
2080 QPC_EXEC path$&'ipconfig.bat'
2090 REMark Now read the result
2100 REPeat loop
2110 ch=FOP_IN("dos3_output.txt")
2120 IF ch>0 THEN EXIT loop
2130 END REPeat loop
2140 REPeat loop
2150 IF EOF(#3) THEN EXIT loop
2160 a$=INKEY$(#3)
2170 IF CODE(a$)=13 THEN NEXT loop
2180 PRINT a$;
2190 END REPeat loop
2200 CLOSE#ch
2210 DELETE "dos3_output.txt"
2220 DELETE "dos3_ipconfig.bat"
2230 END DEFine IPCONFIG
The above is not perfect, it's just a proof of concept. It would be better if it was a Function that returned a string, rather than a Procedure. So you could analyse the returned results in a program.
You could probably make it handle more generic DOS commands, like, PRINT DOS_CMD("dir c:\") to get a dos directory of the C: drive.
As for my IP PING program, I think I will rename the PING command as IP_PING and release it.
Martin
Re: IP Ping
I wonder how this scheme of using a DOS batch file would work with QPC2 running under Wine. I also wonder if this is portable to other emulators like SMSQmulator.
Tim Swenson
Tim Swenson