Jump to content

Listening socket


mcky

Recommended Posts

Basically I'm trying to create a socket to listen to a TF2 server's logs, but I lack any decent PHP skills.

 

This is all I have so far:

 

<?php
$socket = stream_socket_server('udp://250.250.250.250:6789', $errno, $errstr, STREAM_SERVER_BIND);
$data = stream_socket_recvfrom($socket, 4096);

echo "Data: ".$data;

fclose($socket);
?>

 

It does receive the incoming data but it dies straight after the first line is received. I'm guessing some sort of loop is required (as the incoming data is consistent), but I have no idea where to start.

 

Any help would be appreciated.

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/115397-listening-socket/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.