If you using a Flash client - you should know some specific features:
1) when client connects to the server - it is sending to you "<policy-file-request/>"."\0" string. Server should answer an XML policy file, then disconnect from this client. Code is something like
if ('<policy-file-request/>'==substr($data, 0, 22))
{
echo "policy requset.\n";
flush();ob_flush();
$msg = '<'.'?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<allow-access-from domain="*" to-ports="*" />
</cross-domain-policy>'."\0";
echo "Say to client (crossdomain.xml) ... ";
flush();ob_flush();
socket_write($read_sock, $msg, strlen($msg));
echo "OK\n";
flush();ob_flush();
echo "Closing ... ";
flush();ob_flush();
socket_close($read_sock);
echo "OK\n";
flush();ob_flush();
}
else
{
// here is normal IO operations with client
}
2) every output to client should be ended with "\0" (if using XMLSocket in Flash client) - otherwise flash will not generate onData event
Russian examples is there - http://www.flasher.ru/forum/showpost.php?p=901346&postcount=7