Error means OOB?  Wow.  How'd you learn that?

You are saying socket_handler is edge-triggered on read and write, but 
what I have seen (if I tested correctly) is that it is edge-triggered 
only on write, and on read it calls whenever there is work.  So:

data arrives on sockets 0 and 1
socket_handler is called
it reads socket 0
socket_handler exits
socket_handler is immediately called again


or


data arrives on socket 0
socket_handler is called
it reads socket 0, but only part of the data
socket_handler exits
socket_handler is immediately called again



 > The sdasync actually provide information for the identification of
 > socket and the type of event.  If you process this message then it is
 > no need to do sdselect.
 >

I don't understand what you mean here.  What message are you talking 
about, and how do I process it?  (Are you hinting at a general way of 
handling messages that wd doesn't support?  That would be great.)

Henry Rich

bill lam wrote:
> On Thu, 19 Feb 2009, Henry Rich wrote:
>> 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.
> 
> I suppose you use the window sdasync extension. Your observation
> should be correct.  It is edge trigger in that it will not trigger
> again if you did not process that read/write that socket. It is more
> robust to process all available read/write list inside a call.
> 
> The error list does not indicate error happened, but informs the arrival
> of oob (out of bound) packets from the remote side.  Usually you do
> not need to process it.
> 
> The sdasync actually provide information for the identification of
> socket and the type of event.  If you process this message then it is
> no need to do sdselect.
> 
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to