ID:               32469
 User updated by:  mccaskey at stanford dot edu
 Reported By:      mccaskey at stanford dot edu
-Status:           Feedback
+Status:           Open
 Bug Type:         Filesystem function related
 Operating System: Windows XP
 PHP Version:      5.0.3
 New Comment:

Tried it. No difference.


Previous Comments:
------------------------------------------------------------------------

[2005-03-29 00:40:59] [EMAIL PROTECTED]

Please try using this CVS snapshot:

  http://snaps.php.net/php5-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5-win32-latest.zip



------------------------------------------------------------------------

[2005-03-28 03:56:10] mccaskey at stanford dot edu

Description:
------------
(1) Open a COM port as a serial input using fopen. Read using fread or
fgets. No data appears until 8K bytes have been read. There is an 8K
buffer on writes, but there shouldn't be one on reads. (Should there?)
Are reads somehow using the write buffer? Sure enough:

(2) Again, open a COM port as a serial input using fopen. This time,
write some characters using fwrite. Now fread 8K of serial data. At the
head of that stream appears the data you had written with fwrite. Oops.

[Several people have reported an inability to get fgets to read COM
data, saying they tried and fgets just never sees any input. I assume
this was their problem. But others have reported using fgets on COM
successfully. Something specific to OS/PHP versions?] 

Reproduce code:
---------------
(1) 
$serial_port = fopen("COM4", "r+");
echo(fread($serial_port, 8192));

(2)
$serial_port = fopen("COM4", "r+");
fwrite($serial_port, "MP");
echo(fread($serial_port, 8192));

Expected result:
----------------
(1) & (2)
serial data starting with the first byte that came in on the serial
line


Actual result:
--------------
(1) Nothing until 8K of data has been read in.

(2) After enough serial data to fill the buffer, first the data written
("MP" in this example), then the data that came in on the serial line.


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=32469&edit=1

Reply via email to