[squeak-dev] Re: Socket>>#waitForDataFor: and
#primSocketReceiveDataAvailable
Igor Stasenko
siguctua at gmail.com
Mon Feb 25 17:31:51 UTC 2008
On 25/02/2008, Klaus D. Witzel <klaus.witzel at cobss.com> wrote:
> On Mon, 25 Feb 2008 16:24:43 +0100, Igor Stasenko wrote:
>
> > I think it was done intentionally,
> > when socket closed , it signals that data available, to awake process
> > which waiting for data. Then, when process tries to read it, it
> > returns 0 bytes.
>
>
> Nothing speaks against such behavior except the method's comment "Wait for
> the given nr of seconds for data to arrive. Signal a time out or
> connection close exception if either happens before data becomes
> available."
>
>
> > I think it's same as with socket's read() function.
> > If remote side closed gracefully, a blocking read() function returns
> > with 0, indicating that there 0 bytes read, and connection is closed.
>
>
> So senders of #waitForDataFor: cannot know about closed connections (even
> if the comment says the opposite) and *must* do at least #receiveSomeData
> because #waitForDataFor: can't handle all the possible situations?
>
I really don't know how primitives handling this. So it's only my
guess why data signaled when there is no data at all.
--
Best regards,
Igor Stasenko AKA sig.
More information about the Squeak-dev
mailing list
|