From:             khayll at motoros dot hu
Operating system: win 2k3 server
PHP version:      4.4.0
PHP Bug Type:     Sockets related
Bug description:  SO_RECVTIMEO sec stands for usec!!!! and usec has no effect!

Description:
------------
I tried to set a receive timeout for a socket, but found out that sec is
used as usec, and usec is in fact ignored!


Reproduce code:
---------------
using a modbus device  with "address" address, sorry i cannot make it
available on the net

$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
socket_set_option($socket, SOL_SOCKET, SO_RCVTIMEO, array("sec"=>0,
"usec"=>500));
socket_connect($socket, "address", "502");
socket_write($this->socket, $data, strlen($data));
socket_read($this->socket, 512, PHP_BINARY_READ);



Expected result:
----------------
expected to read some data or give a timeout error.


Actual result:
--------------
code hangs, so i figured out, that usec has no effect, then i tried 1 sec
as timeout, code began to work, but kept reporting timeout, so i figured
out if i try a value like 500000 as sec it works. Seems like sec is used
as usec, and usec has no effect.


-- 
Edit bug report at http://bugs.php.net/?id=34851&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=34851&r=trysnapshot4
Try a CVS snapshot (php5.0): 
http://bugs.php.net/fix.php?id=34851&r=trysnapshot50
Try a CVS snapshot (php5.1): 
http://bugs.php.net/fix.php?id=34851&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=34851&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=34851&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=34851&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=34851&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=34851&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=34851&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=34851&r=notwrong
Not enough info:             
http://bugs.php.net/fix.php?id=34851&r=notenoughinfo
Submitted twice:             
http://bugs.php.net/fix.php?id=34851&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=34851&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=34851&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=34851&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=34851&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=34851&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=34851&r=float
No Zend Extensions:          http://bugs.php.net/fix.php?id=34851&r=nozend
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=34851&r=mysqlcfg

Reply via email to