Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1044815
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T15:53:17+00:00 2026-05-16T15:53:17+00:00

so – I have this Socket (not XMLSocket, just Socket) client. I also have

  • 0

so – I have this Socket (not XMLSocket, just Socket) client. I also have a custom PHP script on my server, that listens on port X. My client tries to connect to it.

Everything works fine, the security and communication, sync and whatever else. But – the Flash Player (AIR runtime actually) shoots an error when trying to connect, but ONLY when the server is not running… What? It is really weird – the error is actually handled by try catch (IOError), and even weirder, the line that is specified in the output as the error line is the line where I just CREATE the Socket…?

Hm…

Output:

Error #2044: Unhandled IOErrorEvent:. text=Error #2031: Socket Error.
    at ---.server::Client()[---/server/Client.as:167]
    at Function/<anonymous>()[---_fla.MainTimeline::frame1:430]
    at Function/<anonymous>()
    at Function/<anonymous>()[---_fla.MainTimeline::frame1:375]

Code:

try {
    Sock = new Socket(); // THIS is line 167
} catch (e:IOError){
    log("Could not connect!");
    status = "disconnected";
}

It does not really matter – the server is supposed to be still online, the errors won’t show up… But ignoring an error is not good.

One more thing: when I comment out the line where I actually connect using Sock.connect(…) – it does not throw the error, but it obviously does not work… Also, the connect part is also in try catch (IOError) block…

WHY does Flash say the problem is on line 167 when it is obviously elsewhere? And / or what can be the problem?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T15:53:18+00:00Added an answer on May 16, 2026 at 3:53 pm

    This might not seem obvious if you had not worked with Flash previously, but many Errors in the net api are asynchronous. Meaning, you cannot catch them with a catch block, because the error is not thrown when you execute the connect method, but at a later point.

    In fact, the error message says you have an uncaught IOErrorEvent not an IOError.

    This is covered here:

    http://www.adobe.com/livedocs/flash/9.0/ActionScriptLangRefV3/flash/net/Socket.html#connect()

    Basically, you have to add a handler for the IOErrorEvent (adding one for SecurityErrorEvent is a good idea as well). Something like this:

    private function connect():void {
        socket = new Socket(host,port); 
        //  handle asynchronous errors in these handlers
        socket.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
        socket.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
        try {
            socket.connect();
        } catch(ioError:IOError) {
        //  handle synchronous errors here  
        } catch(secError:SecurityError) {
        // and here
        }
    }
    
    private function ioErrorHandler(event:IOErrorEvent):void {
        trace("ioErrorHandler: " + event);
    }
    
    private function securityErrorHandler(event:SecurityErrorEvent):void {
        trace("securityErrorHandler: " + event);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have this code: <?php $valid_ext = array(pdf, doc); $args = array( 'post_type' =>
I have a PHP application that stores PHP datetime to my MySQL table. I
Have a webpage that will be viewed by mainly IE users, so CSS3 is
I've got the following login script.. <?php $name = $_POST[name]; $password = $_POST[password]; $query
I have a simple restful service that transforms a JAXB-anntotated beans to response XML
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
My NSXMLParser breaks on this string: <title>AAA &#8211; BCDEFGQWERTYUIO</title> I parsed it in this
I need a function that will clean a strings' special characters. I do NOT
I am getting notice on line 30 that twetout is undefined variable <?php $username
So to start, I have an array of XML files. These files need to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.