Click to See Complete Forum and Search --> : Ping by port
prophit
12-21-2006, 03:21 PM
I was wondering if you could ping by port using php. I have a script now that pings. I have a router in place and i have a few other devices behind that router which i can access remotely. I wanted to setup a script that will also ping those devices by thier remote port number. Any ideas?
Thanks!!!
sahaya
10-22-2011, 04:43 AM
i tried ping test here
whoisxy.com (http://www.whoisxy.com/)
my results are
Reply from 173.203.189.224: bytes=32 time<1ms TTL=128
Reply from 173.203.189.224: bytes=32 time<1ms TTL=128
Reply from 173.203.189.224: bytes=32 time<1ms TTL=128
Reply from 173.203.189.224: bytes=32 time<1ms TTL=128
Ping statistics for 173.202.190.224:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms
savvykms
10-22-2011, 05:24 PM
Are you trying to determine if a client is still connected? An easy method is to use Javascript and AJAX.
If you aren't trying to determine connectivity, you could user $_SERVER["REMOTE_PORT"] (I think) and try opening a socket to it; I doubt this would work, but if it did, you'd know it will work (provided you are talking TCP, not UDP).
eval(BadCode)
10-25-2011, 06:41 AM
PHP doesn't get that low level (that I know of). But I would bet you can find a pear repo that provides that kind of functionality.
Also, what exactly do you mean by ping by port? You can syn scan; otherwise you can start playing with the tcp flags. Not everyone follows RFCs, especially me, so you can't count on something like this unless the devices belong to you.
With all of that said, try Net_Socket. (pear).