Copy link to clipboard
Copied
Hey All,
If anyone has a fix for this it would be greatly appreciated, or just let me know if I'm missing something, but I can't seem to get a port open while running on iOS. I've read a lot of reasons for this is that the port is still in-use from a previous session of the application that failed to close the port properly, but that is simply not there case here. To test this, I've tried looping through a variety of different port ranges on application start, and this error occurs on every port attempted...
import flash.net.ServerSocket;
import flash.net.Socket;
...
for (var port:Number = 1000; port <=1020; port++){
var serverSocket:ServerSocket = new ServerSocket();
serverSocket.addEventListener(Event.CONNECT, socketConnectHandler);
serverSocket.bind(port);
serverSocket.listen();
}
it breaks every time on serverSocket.bind(port) with "Error #2002: Operation attempted on invalid socket.";
Any help would be greatly appreciated. Also, I'm using Flash Builder 4.6 compiling to Flex 4.6.0 SDK.
Thanks!
Copy link to clipboard
Copied
Docs for ServerSocket:
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/ServerSocket.html
Note: This feature is supported on all desktop operating systems, but is not supported on mobile devices or AIR for TV devices.
You should trace ServerSocket.isSupported and you'll see it's not supported on iOS devices.
Believe me, I frikin wish they'd support that and SecureSocket.