php udp
Warning: socket_read() expects parameter 1 to be resource, boolean given in ... on line 15
PHP Warning: socket_accept(): unable to accept incoming connection [0]: The attempted operation is not supported for the type of object referenced in ... on line 14
kod:
<?php
set_time_limit (0);
$host = "0.0.0.0"; //IP hostu
$i=0;
$ink = 0;
$port = 9000;
$socket = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
$bind = socket_bind($socket, $host, $port);
socket_recvfrom($socket, $buf, 12, 0, $host, $port);
$listen = socket_listen($socket, 0);
$f = fopen("text.txt","w");
while(true)
{
$spojenie = socket_accept($socket);
$read = socket_read($spojenie, 20480);
$add = $read."\n";
fwrite($f,$add);
//socket_close($spojenie);
}
?>
Pre pridávanie komentárov sa musíte prihlásiť.
Zdroj: http://www.phpbuilder.com/board/showthread.php?t=10360422
Keby daco ozvi sa mi cez jabber / gtalk, kontakt na mna mas .. :)