From:             tuan at sarasavi dot lk
Operating system: Ubuntu
PHP version:      5.3.19
Package:          Sockets related
Bug Type:         Bug
Bug description:Php Warning: Socket_Read(): Unable To Read From Socket [104]

Description:
------------
This script working fine, but after couple of hours I have got some errors

Test script:
---------------
<?php
ini_set('error_reporting', E_ALL ^ E_NOTICE);
ini_set('display_errors', 1);
require_once '../includes/session.php';
require_once '../includes/connection.php';
require_once '../classes/logfile.php';
require_once '../classes/Tracker.php';
?>
<?php



$address = '192.168.1.225'; // IP Address
$port=9000; //Port


$sock = socket_create(AF_INET, SOCK_STREAM, getprotobyname('tcp'));
socket_bind($sock, $address, $port) or die ("cannot bind to address.");
echo socket_strerror(socket_last_error());
socket_listen($sock,20);
$i=0;
while(1){
$result = $client[++$i] = socket_accept($sock);
$input = socket_read($client[$i], 1024000);


if($result):
$data = 'Thank you for your request!' . " \r\n";
socket_write($client[$i], $data, 1024000);
endif;


socket_write($client[$i], $input , 1024000);

$finInput = $input;

echo $finInput . "\r\n";

$lf = new Logfile();
$lf->write($finInput);

$tracker = new Tracker();

$data_array = $tracker->splitdata($finInput);
$location = $tracker->getlatlng($data_array[5], $data_array[7]);

$newloc = array();

$newloc['lat'] = $location['lat'];
$newloc['lng'] = $location['lng'];
$newloc['imei'] = $data_array[16];
$newloc['signal'] = $data_array[15];
$newloc['speed'] = $data_array[9];
$tracker->addlocation($newloc);
echo "\r\n";
print_r($newloc);

socket_close($client[$i]);
}
socket_close($sock);
?>

Actual result:
--------------
PHP Warning:  socket_read(): unable to read from socket [104]: Connection
reset 
by 
peer in /var/www/gpssys/bin/deamon_test.php on line 41

Warning: socket_read(): unable to read from socket [104]: Connection reset
by 
peer 
in /var/www/gpssys/bin/deamon_test.php on line 41
PHP Warning:  socket_write(): unable to write to socket [32]: Broken pipe
in 
/var/www/gpssys/bin/deamon_test.php on line 45

Warning: socket_write(): unable to write to socket [32]: Broken pipe in 
/var/www/gpssys/bin/deamon_test.php on line 45
PHP Warning:  socket_write(): unable to write to socket [32]: Broken pipe
in 
/var/www/gpssys/bin/deamon_test.php on line 51

Warning: socket_write(): unable to write to socket [32]: Broken pipe in 
/var/www/gpssys/bin/deamon_test.php on line 51

-- 
Edit bug report at https://bugs.php.net/bug.php?id=63803&edit=1
-- 
Try a snapshot (PHP 5.4):   
https://bugs.php.net/fix.php?id=63803&r=trysnapshot54
Try a snapshot (PHP 5.3):   
https://bugs.php.net/fix.php?id=63803&r=trysnapshot53
Try a snapshot (trunk):     
https://bugs.php.net/fix.php?id=63803&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=63803&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=63803&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=63803&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=63803&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=63803&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=63803&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=63803&r=notwrong
Not enough info:            
https://bugs.php.net/fix.php?id=63803&r=notenoughinfo
Submitted twice:            
https://bugs.php.net/fix.php?id=63803&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=63803&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=63803&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=63803&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=63803&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=63803&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=63803&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=63803&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=63803&r=mysqlcfg

Reply via email to