Hi,

I have a GSM modem connected to /dev/ttyS0 and would like to use php
to communicate with the modem. Writing works perfectly like this:

$fp=fopen("/dev/ttyS0","r+");
fwrite($fp,"AT+CMGL\r");

but reading is a little problem because if the modem for example answers
to the "AT+CMGL" message I sent to it with the command above it does NOT
put an EOF at the end of the stream. For example the following code

while (!feof($fp)) {
 print=fgetc($fp);
}

blocks after it read the last char and waits for the next char that will
never come. I tried to use filesize() and 
 fseek ($fp,0,SEEK_END); 
 print ftell($fp);
to find out the length of the answer of the modem but it didn't work.

Anybody knows a solution? For example a timeout parameter of fread, fgetc?
Or whatever ...

Thanks
Tobias

-- 
Sign the Petition for a Software Patent Free Europe:
http://petition.eurolinux.org/

Tobias Fritz
[EMAIL PROTECTED]
http://tobias.fritz.net/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to