I'm just trying to read mDNS queries that are sent to my computer:
$socket = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP) or die("Could not create socket\n");
socket_bind($socket,'192.168.2.149',5353) or die ("Could not bind socket\n");
while(true)
{
socket_recvfrom($socket,$buf,65535,0,$clientIP,$clientPort);
echo $buf;
}
socket_close($socket);
When I run this from the command line (windows) it says:
Warning: socket_bind(): unable to bind address [0]: Only one usage of each socke
t address (protocol/network address/port) is normally permitted.
in C:\Users\Senica\Desktop\Apple Project\connect.php on line 8
Could not bind socket
If I change the port to 53 it's fine. Any ideas?