Q: How to connect client and server with socket? How do I actually run this client/server project on ActionScript 3? I'm using flashbuilder. I'm not sure if I'm even doing the right thing, i made a new as mobile project and put in the code for my client which is this:
public class client extends Sprite
{
    private var socket:Socket;
    private var IP:String = "127.0.0.1";

    public function client()
    {
        super();

        socket = new Socket();
        socket.addEventListener(Event.CONNECT, onConnected);
        socket.connect(IP, 5555);
    }

    protected function onConnected(event:Event):void
    {
        socket.writeUTFBytes("communication between Sockets (Client socket and server socket)");
        socket.flush();
    }
}

and then I made a new class within the package that has the client class (as above) in it and put in this as the server class:
public class NewSocketServerTest extends Sprite
{
    private var serverSocket:ServerSocket = new ServerSocket();
    private var clientSocket:Socket;

    private var txt:TextField;
    public function NewSocketServerTest()
    {
        createUI();
        serverSocket.bind(5555);
        serverSocket.addEventListener(ServerSocketConnectEvent.CONNECT, onConnected);
        serverSocket.listen();
    }

    protected function onConnected(event:ServerSocketConnectEvent):void
    {
        txt.appendText("This is a demonstration of \n" );
        clientSocket = event.socket;
        clientSocket.addEventListener(ProgressEvent.SOCKET_DATA, onDataHandler);
    }       

    protected function onDataHandler(event:ProgressEvent):void
    {
        var str:String = clientSocket.readUTFBytes(clientSocket.bytesAvailable);
        txt.appendText(str);
    }

    private function createUI():void
    {
        txt = new TextField();
        txt.width=400;
        txt.height=400;
        txt.appendText("Hello! \n");
        addChild(txt);
    }
}

When I try run this in an emulator it's just a white screen and I'm not sure what I'm doing wrong.

A: Try specifying the serverSocket hostname.
serverSocket.bind(5555,"127.0.0.1");

