Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.

  1. #1

    Default coldfusion Ping

    hi guys!

    i am developing an application for the company i work and the problem is the
    next :

    i am currently developing a flash based client that acceses to a ftp server
    and the extract some files from 1 directory that contains many txt, then i get
    the that info into flash so i can select 1 determined text file in the ftp and
    read it into flash

    the problem comes when i want to know if the remote host is connected to give
    them support, the remote hosts are stores that get connected by dialing a
    number to connect to the internet, so making ping is a vital part of the
    application being created

    is there a way or a tag to do this, i have right now coldfusion 6.1 developer
    edition

    thx for any help!

    AcidGuy Guest

  2. Similar Questions and Discussions

    1. ping
      Hi all, How can i do a simple ping with asp.net, returning only the time of the ping??? Thanks in advance, Fabio
    2. ttl value when ping...
      Hi there, When I ping, for example www.cjman.com it returns a ttl value of 119. If I ping www.gallaudet.edu, it returns a value of 50. I have...
    3. Net::Ping
      Using this module to test SMTP (port 25) connections, I want to close the connection gracefully instaed of simply closing the connection. Is there...
    4. IP ping
      I have some programs that connect to servers, etc. that time out after non use for 20 minutes or so. If there some program I can load or use...
    5. can't ping lan
      Hi I'm trying to set up IP masquerading. I had it set up under a previous install, but I can't get it going now. The problem seems to be related...
  3. #2

    Default Re: coldfusion Ping

    You could probably do something like this:

    <cftry>
    <cfexecute name="ping.exe" arguments="ftp.whatever.com"
    timeout="5"></cfexecute>
    <cfcatch type="Any">
    Ping failed
    </cfcatch>
    </cftry>

    JonathanBigelow Guest

  4. #3

    Default Re: coldfusion Ping

    this worked perfectly but the informartion returned is poor or none at the end
    of the 5 seconds transaction,

    just return something when the operation has failed and a null when the
    operation or the ping has been estabilished, is there a way to get more details
    ?

    thx in advanced !

    AcidGuy Guest

  5. #4

    Default Re: coldfusion Ping

    if it doesn't need to be ping, you might look at java sockets (i'm at home,
    i'll see if i can post better code when i get to the office tomorrow). this is
    from memory:


    <cfscript>
    try {
    socket=CreateObject("java", "java.net.Socket");
    hostIP=javacast("string", "10.10.10.10"); // your remote host goes here
    dayTimePort=javacast("int", 13);
    socket.init(hostIP, dayTimePort);
    socket.setSoTimeout(100);
    ServerIP = socket.toString();
    ServerPort = socket.getPort();
    socket.close()
    } // try
    catch ("java.net.SocketException",e) {
    socket.close();
    }
    </cfscript>

    PaulH Guest

  6. #5

    Default Re: coldfusion Ping

    What version of CF are you using? On 6.1 I get the following output with just
    that code:

    Pinging [url]www.yahoo.akadns.net[/url] [66.94.230.34] with 32 bytes of data:
    Reply from 66.94.230.34: bytes=32 time=31ms TTL=51
    Reply from 66.94.230.34: bytes=32 time=235ms TTL=51
    Reply from 66.94.230.34: bytes=32 time=313ms TTL=51
    Reply from 66.94.230.34: bytes=32 time=31ms TTL=51
    Ping statistics for 66.94.230.34: Packets: Sent = 4, Received = 4, Lost = 0
    (0% loss), Approximate round trip times in milli-seconds: Minimum = 31ms,
    Maximum = 313ms, Average = 152ms

    You should be able to parse through that pretty easily to clean up the results
    if you like...

    JonathanBigelow Guest

  7. #6

    Default Re: coldfusion Ping

    Also you can speed it up a bit by using

    <cfexecute arguments="www.yahoo.com -n 1"....></cfexecute>

    which will only send 1 echo request.
    JonathanBigelow Guest

  8. #7

    Default Re: coldfusion Ping

    maybe the problem is in the server trying to send the vars to flash, what i see
    is a big line of space ... , i will make function all those codes trying from
    diferent ways tomorrow, now i have to go to university

    thx for your support !

    AcidGuy Guest

  9. #8

    Default Re: coldfusion Ping

    just to keep my promise:

    <cfscript>
    try {
    socket=CreateObject("java", "java.net.Socket");
    readerObj=createObject("java","java.io.InputStream Reader");
    bufferedObj=createObject("java","java.io.BufferedR eader");
    hostIP=javacast("string", "10.10.10.10"); // your remote host goes here
    dayTimePort=javacast("int", 13); // or some other port that is allowed on
    their firewall/host
    socket.init(hostIP, dayTimePort);
    socket.setSoTimeout(1000); // some reasonable timeout value
    inReader=readerObj.init(socket.getInputStream());
    bReader=bufferedObj.init(inReader);
    isAlive=true;
    // check that box
    tStamp=bReader.readLine();
    ServerIP = socket.toString();
    ServerPort = socket.getPort();
    socket.close();
    if (isAlive)
    writeoutput("server #serverIP# (#serverPort#) is alive at #tStamp#");
    } // try
    catch ("java.net.SocketException" e) {
    socket.close();
    isAlive=false;
    writeoutput("server #hostIP# (#dayTimePort#) is dead as a doorknob at
    #now()#");
    }
    </cfscript>

    PaulH Guest

  10. #9

    Default Re: coldfusion Ping

    i think there is something missing in the code,
    it gives me the next error with flash Remoting :


    --------------------------------------------------------------------------------
    ---------------------
    Service threw an exception during method invocation: Object Instantiation
    Exception.

    --------------------------------------------------------------------------------
    ---------------------

    And with Coldfusion :


    --------------------------------------------------------------------------------
    ---------------------
    Object Instantiation Exception

    --------------------------------------------------------------------------------
    ---------------------

    AcidGuy Guest

  11. #10

    Default Re: coldfusion Ping

    which code?
    PaulH Guest

  12. #11

    Default Re: coldfusion Ping

    Paul,

    What is a good port to try this on for a server? I have tried
    80,0,425,1089,1099,1505 and 9595. I still get the result back that the server
    is "dead a a doorknob". Any help would be appreciated!

    Thanks!

    CF_DAWG Guest

  13. #12

    Default Re: coldfusion Ping

    that port should work for the most part. port 80, etc. depends on what's
    running on that host. and all of these (including doing a command line ping)
    are controlled by firewalls, security, etc. i guess you might try one of the
    ftp ports (20/21) since you seem to be doing ftp.


    PaulH Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139