A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: [CS3] Port checker.

  1. #1
    Junior Member
    Join Date
    Oct 2007

    [CS3] Port checker.

    Hello I would like to add a server online/offline feature on my website. I run a gaming service, so I would like my users to see whether the server is online/offline. An example of what I want to do can be seen on www.l2refused.com, under Server Status. Thanks everyone.

  2. #2
    Moderator whispers's Avatar
    Join Date
    Mar 2001
    CFA2h (respect the HEX)
    well.. how to you 'turn off your server'?

    it could be as simple as a flash movie that look for a certain file/image...

    if its there.. display it (or say ON-LINE)

    if its NOT there.. display OFF-LINE

    maybe you have this file/image on your server that you take on/of line

    so if Flash can find it (its on line) if not.. (its off line and it does a default message)

  3. #3
    Junior Member
    Join Date
    Oct 2007


    You don't understand, the server is a service running on port 666 let's say, just like MySQL, Apache, MSSQL. Something like this. The SERVER MACHINE might be online, but the SERVICES might be offline.
    So the get-file thing doesn't work for me.

  4. #4
    Senior Member
    Join Date
    Oct 2004
    your best bet would be to use some back end script (like php) to check the port. Then have flash to check the return value of the script.

    here is an example with php to check the ports

    PHP Code:
    < ?php
    // Your Domain to check
    $site "www.vinuthomas.com";
    // Port to check - Default port 80 for webserver
    // You can check other ports by changing the
    // value of $port
    $port 666;
    //open the port and check
    $fp fsockopen($site,$port,$errno,$errstr,10);
    "Cannot connect to server";
    // you can send your notification mail here.
    "Connect was successful - no errors";

  5. #5
    Junior Member
    Join Date
    Oct 2007
    Can I have more detailed instructions about this? I'm really a beginner in php, don't really know much about it. And what's the AS I have to add to Flash? Thanks.

  6. #6
    Join Date
    Nov 2006
    k, I'm no expert at PHP, but I dabble...looks like his script just checks to see if port 666 is open and prints a string depending on whether it is or not...what you would need to do is take that script (assuming it works), put it on your server, and from your AS code call that PHP script and add an event listener to see when it's done loading and capture what it's outputting (ie. the socket status) and do some action based on which response you get.

    So treat the PHP script like a test as to whether to socket is open and when it says, "I'm open" via the echo statement, make your AS do what you want. When it says, "I'm closed", do something diff in your AS. The echo statement is just a 'print' function that will output to screen or in your case, to your AS code.

Posting Permissions

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

Click Here to Expand Forum to Full Width

HTML5 Development Center