| nbvehfuanet |
21.01.2010 20:48 |
подключение к пхп-сокет серверу
Вот сам этот сервер
Код:
<?
header('Content-Type: text/plain;');
error_reporting(E_ALL ^ E_WARNING);
set_time_limit(0);
ob_implicit_flush();
echo "-= Server =-\n\n";
$address = 'la2fy.compufa.ru';
$port = 4577;
try {
echo 'Create socket ... ';
if (($sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP)) < 0) {
throw new Exception('socket_create() failed: '.socket_strerror(socket_last_error())."\n");
} else {
echo "OK\n";
}
echo 'Bind socket ... ';
if (($ret = socket_bind($sock, $address, $port)) < 0) {
throw new Exception('socket_bind() failed: '.socket_strerror(socket_last_error())."\n");
} else {
echo "OK\n";
}
echo 'Listen socket ... ';
if (($ret = socket_listen($sock, 5)) < 0) {
throw new Exception('socket_listen() failed: '.socket_strerror(socket_last_error())."\n");
} else {
echo "OK\n";
}
do {
echo 'Accept socket ... ';
if (($msgsock = socket_accept($sock)) < 0) {
throw new Exception('socket_accept() failed: '.socket_strerror(socket_last_error())."\n");
} else {
echo "OK\n";
}
$msg = '<?xml version="1.0" encoding="utf-8"?>
<response>
<id>1</id>
<x0>4</x0>
<y0>50</y0>
</response>';
echo "Say to client ($msg) ... ";
socket_write($msgsock, $msg, strlen($msg));
echo "OK\n";
} while (true);
} catch (Exception $e) {
echo "\nError: ".$e->getMessage();
}
?>
вот теперь вопрос,как подключить флеш к этому серверу и принять переменную $msg
|