Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
Locked
0

iOS Sockets: Error #2002: Operation attempted on invalid socket.

New Here ,
May 01, 2012 May 01, 2012

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!

TOPICS
Development
7.2K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 02, 2012 May 02, 2012
LATEST

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines