I have discovered flash.net.ServerSocket and it’s sticky sweet.

May 13, 2010

I have just discovered the ServerSocket class and I have made an AIR2 (required) server socket application with it. I’ve tested it locally so far (127.0.0.1, 0.0.0.0 ) and it seems to be working fine with a regular application I made using Socket to talk with it. I tried getting another copy of the socket app to talk to the socket server from another machine on the network, but I think a LAN might work better for testing at the moment since I don’t know the dynamics of the huge network that exists at work.

I will be adding some code to this post once I’m sure it’s mostly worked out. The socket server is made outside of Flex, but that shouldn’t change much if you are using Flex to author your AIR 2 application.

Thanks for this post – the code is very easy to follow (though probably because it adheres to the conventions set by the documentation) and it’s a lot easier to understand than the Adobe article on it (documentation? http://www.adobe.com/devnet/air/flex/quickstart/articles/communicating_with_sockets.html) that I personally had a lot of trouble setting up because of things like imports and, specifically, communicating with the client socket upon establishing a connection.