Jump to content

socket


iraab

Recommended Posts

Hi,

This is the code :

 

<?php

error_reporting(E_ALL | E_STRICT);

 

$socket = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);

socket_bind($socket, "127.0.0.1", 2200);

socket_connect($socket,"239.255.255.122",2000);

 

 

$from = "239.255.255.122";

$port = 2000;

 

socket_recvfrom($socket, $buf, 10, 1,$from, $port);

//socket_recv($socket,$buf,0,0);

echo "Received $buf from remote address $from and remote port $port" .

PHP_EOL;

?>

 

This is what I get :

PHP Warning:  socket_recvfrom(): unable to recvfrom [0]: The operation completed

successfully.

 

I've tied a lot of tries to receive this stream.

What I need to do is to check if I get a UDP stream on a multicast address (e.g 239.255.255.122 port 2000).

I just need to check if I get something, just to see it's alive...

I didn't success to do so... is it possible to work on UDP multicast port with socket?

 

Thanks a lot,

Link to comment
https://forums.phpfreaks.com/topic/77908-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.