lundi 2 avril 2018

Socket Listener Laravel

I have following PHP code to listen for the data on a IP and PORT coming from other side(IP and PORT).

while(1)
{
    echo "\n Waiting for data ... \n";

    //Receive some data
    $r = socket_recvfrom($sock, $reply, 2045, 0,$remote_ip, $remote_port);

    echo "Monitor received\n";
    echo "Received from ".$remote_ip;
    echo "Received".$remote_port;
    $procmsg = $a->procCmd(bin2hex($reply));

    var_dump($procmsg);

}

My Question is: How can I build a socket listener on laravel that listens the port and if data detected execute block of code. Do the Laravel Broadcasting can solve this or do I need to use something?

Actually, I want above code in Laravel and run in background to listen the socket.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire