About the socket does not say more, this information on the Internet a lot of information about the flash, there are a lot of data, here only said that the Internet can not find information or information on a very little oh things
PHP socket data are few and few, just search on Google php socket, out of the results page is so three or four articles, point in to see, basically are
Copied from the manual, a little problem can not get up, so I spent two days to make PHP and flash successful communication, hehe
In fact, PHP and flash socket communication is not a difficult problem, the difficulty is the security policy of flash, especially socket, especially in Flash Player 10 requires more
Strict.
Here are a few sections: PHP's socket\flash socket\flash security policy \ How to use PHP to solve this strategy
Want to be helpful to people who lack information, if you use other background language and flash interaction, may be simpler than PHP, because PHP is really not a good thing to do socket,
But maybe you're going to use this at some point.
(1) PHP Socket:
The first piece of code is the code in the program where I implement the communication:
1. <?php
2. Set_time_limit (0);
3. $address = "127.0.0.1";
4. Ob_implicit_flush ();
5./*
6. * Created on 2009-9-14
7. *
8. * To change the template of this generated file go
9. * Window-preferences-phpeclipse-php-code Templates
10. */
11.
$port = ' 8083 ';
13.
if ($sock = Socket_create (Af_inet, Sock_stream, sol_tcp)) < 0) {
echo "Socket_create () Failed:reason:". Socket_strerror ($sock). "\ n";
16.}
17.
if ($ret = Socket_bind ($sock, $address, $port)) < 0) {
echo "Socket_bind () Failed:reason:". Socket_strerror ($ret). "\ n";
20.}
21st.
if ($ret = Socket_listen ($sock, 5)) < 0) {
echo "Socket_listen () Failed:reason:". Socket_strerror ($ret). "\ n";
24.}
do {
if (!) ( $msgsock = socket_accept ($sock))) {
echo "Socket_accept () Failed:reason:". Socket_strerror ($msgsock). "\ n";
break;
29.}
30./* Begin accepting data s from socket. */
31.
do {
33.
34.//If it is a security policy request, transport the contents of the Security policy file
if ($buf = Socket_read ($msgsock, 2048)) {
if (Strpos ($buf, ' policy-file-request ')) {
$msg = "<cross-domain-policy><allow-access-from domain= ' * ' to-ports= ' *"/></cross-domain-policy > ";
Socket_write ($msgsock, $msg. " ", strlen ($msg.) ));
39.}
40.
41.//Reply data
42.
$talkback = "Php:you said ' $buf '. \ n";
Socket_write ($msgsock, $talkback, strlen ($talkback));
45.
46.}
47.
.} while (true);
Socket_close ($msgsock);
while (true);
//socket_close ($spawn);
//socket_close ($socket);
?>