Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

QUIC protocol

Hi all, i have a simple website hosted on a Server. I'm using QUIC as protocol and everything seems fine:

https://ibb.co/qywqQkC

Now,i wrote a simple script on the client that just keep sending packets to the host using php, but in wiresharks those packets are sent though UDP instead of QUIC.

Any suggestion on how to change and actually use QUIC?

https://ibb.co/J78B3zw

This is the script on the client

$server = 'X.X.X.X';
$port = 443;


$controllerSensors = new ControllerSensors();
$controllerSensors->createSensor("Sensore Bologna", "Temperatura", $server, $port, 1);
$controllerSensors->createSensor("Sensore Modena", "Temperatura", $server, $port,4);
$controllerSensors->createSensor("Sensore Reggio", "Umidità", $server, $port,8);
$controllerSensors->runAllSensors();

Run All Sensons script:

            if(!($this->socket = socket_create(AF_INET, SOCK_DGRAM, 0))){
                $errorcode = socket_last_error();
                $errormsg = socket_strerror($errorcode);
                die("Couldn't create socket: [$errorcode] $errormsg \n");
            }
          if( ! socket_sendto($this->socket, $input , strlen($input) , 0 , $this->ip , $this->port)){
                $errorcode = socket_last_error();
                $errormsg = socket_strerror($errorcode);
                die("Could not send data: [$errorcode] $errormsg \n");
            }

And finally the server script:

$ip = "0.0.0.0";
$port = "443";

error_reporting(~E_WARNING);
if(!($sock = socket_create(AF_INET, SOCK_DGRAM, 0))){
    $errorcode = socket_last_error();
    $errormsg = socket_strerror($errorcode);
    die("Couldn't create socket: [$errorcode] $errormsg \n");
}

// Bind the source address
if( !socket_bind($sock, $ip , $port) ){
    $errorcode = socket_last_error();
    $errormsg = socket_strerror($errorcode);
    die("Could not bind socket : [$errorcode] $errormsg \n");
}

while(true){
    $messageRecieved = "";
    $r = socket_recvfrom($sock, $messageRecieved, 512, 0, $remote_ip, $remote_port);        
    echo $messageRecieved . "<br>";
}

Shouldn't this script use QUIC for the data sent instead of UDP since the website is using QUIC? Thanks, Davide.