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?