php-windows Digest 11 Jul 2004 11:25:42 -0000 Issue 2314
Topics (messages 24138 through 24138):
A problem with dio functions
24138 by: Teemu N�ppi
Administrivia:
To subscribe to the digest, e-mail:
[EMAIL PROTECTED]
To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]
To post to the list, e-mail:
[EMAIL PROTECTED]
----------------------------------------------------------------------
--- Begin Message ---
Hello,
I have a problem with using DIO-functions.
I wish to read and write to a serial port with PHP, but the code I'm
using does not function correctly. Everything
appears fine as there are no errors or warnings and dio_write returns
the right amount of bytes meant to be sent to
the port as if they had, but the device at the port does not receive
anything.
The code is run on Windows with Apache 2 and PHP 5 RC3 using DIO as an
extension.
Simple code example:
<?php
$fp = dio_open("COM1:", O_RDWR);
$str = "any_string";
$bytes = dio_write($fp, $str);
print $bytes;
dio_close($fp);
?>
Dio_stat prints the following:
device = 3
inode = 0
mode = 8192
nlink = 1
uid = 0
gid = 0
device_type = 3
size = 0
atime = 0
mtime = 0
ctime = 0
What is "device type 3"? The readout does not change if I change the dio
to open LPT, for example.
Funny thing is that exec("echo ".$str." > COM1:"); works, but it is not
the way I want to use the port.
Does anyone have any ideas what might be wrong with my example, or do I
not fully understand how to use the dio functions?
--- End Message ---