I'm creating a php script for listening incoming data from user. The idea is that user will be able to send UDP packet remotely to their browser and show it on browser.
The script works fine when tested on my localhost by using xampp. After uploading my script in the server, it fails to bind socket connection everytime. I tried port number 50000, 5000, 561, 61 and many others but failing.
Here's my php script, mostly taken from php's website...
$socket = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
if ($socket == FALSE) {
echo 'socket_create failed'.socket_strerror(socket_last_error())."
";
}
if(!socket_bind($socket, $ip, $port)) {
socket_close($socket);
echo 'socket_bind_failed';
}
socket_recvfrom($socket, $buf, 255, 0, $from, $port);
So, I decided to look into well known udp port as shown here, but seems that all is already used up by certain application. My question is, what is the appropriate value for UDP port?