I want to make socket_handler as lean as possible, so that students can 
understand it.  My question is, When is socket_handler called, exactly? 
In particular, if two sockets become ready, and socket_handler handles 
only one, will it be called again when it completes?

 From my experimentation, it looks like socket_handler will be called 
whenever there is any socket on the readable list.  It looks like 
socket_handler is called only once when a socket goes on the writable 
list, and I am guessing that it is called once whenever a socket goes 
from notwritable to writable.  I don't know about errors, but I am 
guessing that socket_handler is called whenever there is a socket on the 
error list.

If all that is correct, then my socket_handler does not need to loop 
internally for read and error processing: it can just take the first 
ready socket and process that, knowing that it will be called again if 
there is anything ready on another socket.

For writing, the appearance of a socket on the writable list indicates 
that a connection has been completed or a queue-full condition has been 
lifted.

Is all that right?

Henry Rich
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to