Skip navigation
ScottTompkins
Currently Being Moderated

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

May 1, 2012 2:12 PM

Tags: #air #adobe #flex #mobile #ios #flash_builder_4.6

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!

 
Replies

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points