Re: select

Jaap Vermeulen (jaap@sequent.com)
Sun, 28 Jun 92 15:15:21 PDT

| > The input would be a list of (fileobject, string) pairs. The string
| > would indicate 'r', 'w', 'e', or any permutation of those letters (for
| > read, write and exception; if you really want to confuse people you
| > could change the 'e' into an 'x' :-) :-).
|
| 'e' sounds reasonable as does the layout of the call.
| The question is how do you specify you wish to select/poll on it
| for both reading and writing? Remember, sockets are bi-directional.

If 'it' is opened for reading and writing, just specify the string 'rw'.

| Or would you prefer that you do a sock.makefile('r') on it first?
| Actually that seems like a nice solution to that. Forget the statement
| above. I answered my own question.

Correct, for sockets you have to create file fileobject before being able
to select on it.

| I like that. But you should make it milliseconds since that is what
| the select() and poll() actually take. (Although for the project I am
| working on, I will probably only set it for 5-10 MINUTES :) )

The question is not what the underlying system call can handle, the
question is what makes sense from python's point of view. :-) If
anybody ever needs millisecond granularity, sure, use that. However I
doubt that it is useful...

| The problem with poll() is that on some platforms, it handles
| sockets, pipes, and files differently than select(). But I think
| that the C code should be able to select which one you wish
| to use via a #define statement when you do the compile.

Well, I assumed the select() semantics. That is, you can select on
anything (if possible; as you point out some systems have
limitations). If you don't select for an exception, and an exception
occurs for one of the fileobjects, you get a python error back
(probably with the value EBADF). Note that this is different from the
sysV poll() system call semantics...

-Jaap-

--
Jaap Vermeulen					+--------------------------+
						| Sequent Computer Systems |
	Internet : jaap@sequent.com		| Beaverton, Oregon	   |
	Uucp	 : ...uunet!sequent!jaap	+--------------------------+