6 Replies Latest reply on Oct 24, 2006 1:54 PM by MikerRoo

    pinging port

      I would like to ping a certain port on a server that we have with coldfusion. I can ping the server but I cannot define the port. I am currently using the attached code. Is there any way to modify that to only ping a defined port?
        • 1. Re: pinging port
          paross1 Level 2
          Since you are using the Windows ping command, you are limited to its options, namely....

          • 2. Re: pinging port
            cmartz Level 1
            Do you know of a way to ping a port without the windows command?
            • 3. pinging port
              paross1 Level 2
              I googled ping port and got lots of hits, including this one.

              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:

              • 4. Re: pinging port
                MikerRoo Level 1
                See the attached.
                • 5. Re: pinging port
                  cmartz Level 1
                  With that script can you define what output is shows on the page based on response time?
                  • 6. Re: pinging port
                    MikerRoo Level 1
                    You have much more work to do if you want "response time" of a port.
                    That concept does not really apply.

                    A regular "ping" always uses the echo port, port 7. Use the DOS/Linux/OS ping command for this.

                    If you want "response time" on some other port, then you must write and run an echo program on each TARGET server.

                    Then you can add to my code to send a small packet and measure the echo time. You will need mad java skilz to do so.

                    But, since you will have to write the target echo routine (unless you are hacking), you can probably use cfhttp to do the timed data swap -- which would be a lot easier.