Martin Mouritzen <mm@guideix.com> wrote:
> int recv(int fd, string buf, int len, int flags)
> Receives data from a connected socket
> May be used with SOCK_DGRAM sockets.
Det var det der skulle til :) Tak for hjælpen - resultatet blev:
<?php
error_reporting (E_ALL);
/* Allow the script to hang around waiting for connections. */
set_time_limit (0);
$address = '192.168.1.2';
$port = 2000;
if (($sock = socket (AF_INET, SOCK_DGRAM, getprotobyname("udp"))) < 0) {
echo "socket() failed: reason: " . strerror ($sock) . "\n";
}
if (($ret = bind ($sock, $address, $port)) < 0) {
echo "bind() failed: reason: " . strerror ($ret) . "\n";
}
while (1) {
while (recv($sock, $buffer, 1024, MSG_WAITALL)) {
if (ereg("exit",$buffer)) {
close($sock);
exit;
}
print $buffer;
}
}
close ($sock);
?>
--
Christian Jørgensen / Pity the poor egg: it only gets laid once.
http://www.razor.dk /