Answer the question
In order to leave comments, you need to log in
Why is php not sending a UDP packet to the server?
There is a simple script
<?php
$server_ip = $_POST['host'];
$server_port = $_POST['port'];
echo "Sending heartbeat to IP $server_ip, port $server_port\n";
if ($socket = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP)) {
for ($i = 1; $i <= 10; $i++) {
$send_socket = socket_sendto($socket, $message, strlen($message), 0, $server_ip, $server_port);
if($send_socket !== 0){
echo "Сокет не отправлен.";
var_dump($send_socket);
}else{
echo "Успеншо отправлен сокет";
}
sleep(1);
}
} else {
echo "Can't create socket";
}
tcpdump -n udp port 4444
Answer the question
In order to leave comments, you need to log in
Check the firewall settings, both on the VPS and in the hosting panel, on the page where the network connection is configured (if any) - you need to make sure that traffic is allowed to pass through this port.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question