PHP restart script.

NSA

sudo apt-get thefuckout.tar.gz
Dec 9, 2011
715
86
Hello,

So I have a small script which opens up a port and listens for a message.

PHP:
set_time_limit(0);
$address="192.168.0.2";
$port="3222";
$sock=socket_create(AF_INET,SOCK_STREAM,0) or die("Cannot create a socket");
socket_bind($sock,$address,$port) or die("Couldnot bind to socket");
socket_listen($sock) or die("Couldnot listen to socket");
$accept=socket_accept($sock) or die("Couldnot accept");
$read=socket_read($accept,1024) or die("Cannot read from socket");
echo $read;

The problem is, upon receiving a message the webpage is stopped.
Which means the port is no longer available.
Is there anyway I can restart it?
I tried putting it all in a function and using goto but I can't get it working.

Any help?
 

NSA

sudo apt-get thefuckout.tar.gz
Dec 9, 2011
715
86
Pretty sure that wouldn't keep the script running if it finished.
I want it to go back to the top of the script when it gets to the end.

Not keep running after the user closes the window.
 

Users who are viewing this thread

Top