LINK="#3366FF" VLINK="#A000A0">

"The Linux Gazette...making Linux just a little more fun!"


(?) The Answer Guy (!)


By James T. Dennis, tag@lists.linuxgazette.net
LinuxCare, http://www.linuxcare.com/


(?) Ping a Port: NOT

From Derek Leung on Wed, 05 May 1999

(?) Hi,

I am just wondering if there is any way that I can code to ping a destination if it is alive or not. However, the server is known to be behind a firewall, and only one port is open to public. So, is there anyone know how to code a "ping" program that could ping on a certain port? I will greatly appreciate for any ideas.

(!) The 'ping' command generates an ICMP echo request packet. ICMP is a protocol over IP that implements "control messages" (flow control, routing, etc.). At level the very concept of TCP/UDP ports is completely irrelevant. (TCP and UDP are other protocols that ride over IP, they are orthogonal to ICMP).
There are a number of programs that you can use for port scanning (and your application seems to call for testing a single port on a single host --- which is a very short list ports to scan). I'd recommend that you look at netcat (sometimes installed as 'nc' on some Linux systems) and nmap.
A quick place to find these and many other interesting tools would be the Trinux web site: http://www.trinux.org

(?) Derek
SDU TEAM

PS. I use PERL to code. If there are any available C module, please let me know too. Thanks.

(!) There are some sophisticated PERL sockets and RAW::IP tools --- you'd want to look at CPAN (http://www.cpan.org) for those. There are numerous modules to allow easy PERL coding for specific network protocols and services --- and there are many sample scripts there.


Copyright © 1999, James T. Dennis
Published in The Linux Gazette Issue 42 June 1999
HTML transformation by Heather Stern of Starshine Techinical Services, http://www.starshine.org/


[ Answer Guy Index ] 1 2 3 4 5 6
7 8 9 10 11 12
13 14 15 16 17 18
19 20 21 22 23 24


[ Table Of Contents ] [ Front Page ] [ Previous Section ] [ Next Section ]