When using feof or fgets script will continue to run until it reaches the maximum mark of 1 minute.
my $socket = new IO::Socket::INET( LocalPort => '5000', Proto => 'tcp', Listen => 5, ReuseAddr => 1, ); my $connection = $socket->accept(); $connection->send("\0");
PHP will not send content until 60 seconds. When using fread it will transmit data (but will only receive \0 back) almost instantly.
$socket = fsockopen('tcp://192.168.56.101', 5000); // virtualbox IP fwrite($socket, '1234'); echo fread($socket, 128); fclose($socket);
The above script will execute almost instantly, but only get \0 .
while(!feof($socket)) { echo fread($socket, 128); }
Using the above script will not send any data until 60 seconds have been completed.
Question
How do I get PHP to send data and retrieve all the data from a Perl socket without a 60 second runtime?
source share