Socket connection between flash and php

Made a socket server, which works nicely. Then i run into a problem.

If i run these commands in php then flash only receives hello1. I believe that that is because sending of hello1 has not finished yet, till hello2 is sent. Is there some socket option that needs to be set or how to fix this.

socket_write($socket,“hello1\0”);
socket_write($socket,“hello2\0”);