Search code examples
actionscript-3serversocket

AS3 ServerSocket can't bind a 2nd time


After successfully connecting to a local port-IP and then calling the close() method on a serverSocketinstance (flash.net.ServerSocket) I am unable to bind a 2nd time. I get the following error message

#2002: Operation attempted on invalid socket.

After closing i checked and serverSocketInstance.bound=false;

Is there something else I need to do to my serverSocketinstance after closing??


Solution

  • After closing the socket you can't use it againt. You must create new socket. Check the documentation: http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/ServerSocket.html#close()