note 97390 added to function.socket-select
| From: | magemerlin at list dot ru | Date: | Sat, 17 Apr 2010 10:24:39 +0000 |
| Subject: | note 97390 added to function.socket-select | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-168343@lists.php.net to get a copy of this message | ||
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
----
Server IP: 213.186.192.247
Probable Submitter: 109.254.21.34
----
Manual Page -- http://www.php.net/manual/en/function.socket-select.php
Edit -- https://master.php.net/note/edit/97390
Del: integrated -- https://master.php.net/note/delete/97390/integrated
Del: useless -- https://master.php.net/note/delete/97390/useless
Del: bad code -- https://master.php.net/note/delete/97390/bad+code
Del: spam -- https://master.php.net/note/delete/97390/spam
Del: non-english -- https://master.php.net/note/delete/97390/non-english
Del: in docs -- https://master.php.net/note/delete/97390/in+docs
Del: other reasons-- https://master.php.net/note/delete/97390
Reject -- https://master.php.net/note/reject/97390
Search -- https://master.php.net/manage/user-notes.php