XML Socket Server Problems

I made a mini echo server in Java that accepts clients, gets information, then pushes the information out the buffer to each client. I used flash as the chat client that connects to the server.

Problem:
When I send a message from flash, my server recieves the message, pushes it out of the buffer. But flash doesn’t get it immediately. I have to send another message to the server for me to receive the first message I sent.

I made sure that when the server sends the message back out that it flushes correctly.

in flash i send the message like this…

var msg:String = “Check”;

send(msg+"
");

and in the Server side…


msg = in.readLine();

Enumeration c = userList.elements();
System.out.println("Global message: " + messageOut);
do
{
Users t = (Users) c.nextElement();
Client m = (Client)t.thread;
m.out.println(messageOut);
m.out.flush();
}
while(c.hasMoreElements());

I tried to cheat my own server by sending messages through flash like this…


var msg:String = “check”;
send(msg);
send("
");

And it works just fine like that.

Anyway I can fix it to where I only need to send one message?

Thanks

If you need the source code just ask and I’ll post it.