You are here: how to set Read timeout ? « PHP Programming Language « IT news, forums, messages
how to set Read timeout ?

Posted by Lisa Pearlson on 11/13/05 23:48

Hi,

I am wanting to write an internet 'server' program. For ease, I want to use
PHP-CLI with XINET super server.
XINET communicates with the 'server' program via STDIN/STDOUT.

I'm not sure how to communicate with the client this way though.. I can open
stdin/out as a file, and use read and write operations, as if it were a
regular file.. however, how can I set read timeouts on file read operations?

Basically what I want is:

- send binary data to the client
- read binary data from client, but with a timeout of 1 second.

So I want a 'blocking' read operation, but one that doesn't block forever,
but times out.
I know how many bytes I expect when doing a read operation, so perferably I
tell the read operation how many bytes to read.. if it is not received
within x seconds, it should time out.

How can this be done in PHP?

I think I have seen examples where somehow the STDIN/OUT is communicated
with by using socket read/write operations, but I have no clue how this is
done.. the advantage would be that the socket timeout functions could be
used.

Lisa

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация