Hi,
I'm trying to write a single-threaded telnet server, but I am cannot find the equivalent of the C "int select(...)" function within Pike.
Is this accomplished via sleep and signal checking, or am I missing something basic?
I know that if I return -1 I enter the "event loop", but I'm looking for a way to "wait" for I/O signals for only the telcom I/O that I am managing in this code.
Any hint would be appreciated.
Thank you for you time, and patience.
Sincerely,
Frank
You want to use Pike.Backend. It's the object that implements the main backend, but you can create such objects yourself and register files in them (->add_file()). Then you do a loop like
while (keep_running) my_backend();
to poll the files in your backend only. Note that my_backend is an object here; it's the lfun `() that starts it (which I think only is confusing). You can supply a timeout parameter to it.
Pike.Backend only exists in 7.4 and later. It also has some bugs unless you use a more or less cvs fresh version (of 7.4 or 7.5).
If you find quirks and things to improve in backend objects, now is a good time to ask since I'm currently messing with it for the sake of fixing SSL.sslfile.
/ Martin Stjernholm, Roxen IS
Previous text:
2003-10-21 19:20: Subject: (no subject)
Hi,
I'm trying to write a single-threaded telnet server, but I am cannot find the equivalent of the C "int select(...)" function within Pike.
Is this accomplished via sleep and signal checking, or am I missing something basic?
I know that if I return -1 I enter the "event loop", but I'm looking for a way to "wait" for I/O signals for only the telcom I/O that I am managing in this code.
Any hint would be appreciated.
Thank you for you time, and patience.
Sincerely,
Frank
/ Brevbäraren
pike-devel@lists.lysator.liu.se