Send Multiple writeUTF Messages Across Socket in AS3?

So with TCP in AS3, I’m trying to write strings over to the server
and then to the clients, but it appears to only be able to read one at a
time. This is not good because I’m sending messages based on keys being
pressed, and the client has an action that needs to be taken place
based on what key is pressed. Since multiple keys can be pressed at a
time, obviously it does not work correctly.

Client example:

if (keys[p1_jump_key])
        {
            p1_up = "down";
            sock.writeUTF("p1_up_down");
            sock.flush();
        }
        else
        {
            p1_up = "up";
            sock.writeUTF("p1_up_up");
            sock.flush();
        }
        if (keys[p1_crouch_key])
        {
            p1_down = "down";
            sock.writeUTF("p1_down_down");
            sock.flush();
        }
        else
        {
            p1_down = "up";
            sock.writeUTF("p1_down_up");
            sock.flush();
        }

And then here is the server:

function socketDataHandler(event:ProgressEvent):void{
var socket:Socket = event.target as Socket;
var message:String = socket.readUTF();
for each (var socket:Socket in clientSockets)
{
        socket.writeUTF(message);
        socket.flush();
}
}

And finally, here is the receiving client (I have a method that allows the server to differentiate between the two):

if(msg=="p1_down_down"){
        p1_down="down";
    }
    if(msg=="p1_down_up"){
        p1_down="up";
    }
    if(msg=="p1_up_down"){
        p1_down="down";
    }
    if(msg=="p1_up_up"){
        p1_down="up";
    }

Now many of you may already see the issue, as when the down key is up, it
sends the message “p1_down_up”. When the up key is up, it sends the
message “p1_up_up”. Both messages are sending at once when neither of
them are being pressed. The receiving client is, I suppose, just getting
one of the signals, or perhaps neither of them. How do I make MULTIPLE
signals get wrote and read over the server? I tried using an array but
you can’t write those apparently. Thank you.