This content has been marked as final. Show 4 replies
I am using socket with Flex and be sure there is no issue.
Timeout is on the connection : once the socket is connected, it is waiting for the data.
If there is no listening port why do you want to wait for ?
BTW you must listen to SecurityErrorEvent and to connect event.
So your code is wrong as you test the connected property just after the connect call.
You must wait for the connect event or an error event.
Call to connect is not blocking !!
Think asynchronous +++
Thanks jylaxx. I was hoping silently that this was an error in my thinking and not a bug, it's sure faster to fix. I changed the code a bit and was able to connect. The bit I was missing is that connect() is asynchronous so I was testing socket for being connected to early.
How (and to what) do I attach an event handler for SecurityErrorEvent?
This event can help to detect security policy error. Use as ioError.
securityError:SecurityErrorEvent — Dispatched if a call to Socket.connect() attempts to connect to either a server outside the caller's security sandbox or to a port lower than 1024. (This restriction is not placed on AIR content running in the application security sandbox.) You can work around either problem by using a cross-domain policy file on the server. For more information, see the "Flash Player Security" chapter in Programming ActionScript 3.0.