Hey I'd just like to thank Joseph and Mars for their help.  It's quite a
privilege to get such prompt feedback.

Joseph J. Strout wrote:
But, to be clear, sockets have code that prevents them from entering
 events if an event is already in process -- except for the Error
event, which will go ahead and fire even if you're already in an
event.

Okay, this is great to know.  It's also something that is *most
certainly* necessary to have in the documentation because it's not
intuitive *at all*.  Shall I create the issue report?

But, that said, I really have a problem with this sort of behaviour.
I'll explain below.

That's why you only see this issue with Error, and why disabling background tasks makes it go away.

Okay, so I'm left in a similar situation I was in before.  How should I
cope with the possibility of the Error event being called whilst I'm in
the middle of handling some other socket event?  If the answer is to
disable background tasks, and disabling background tasks only takes
effect for the current method, then I'm stuck with having to disable
background tasks around every loop (or other statements that yield)
which could be reached from a socket event.  That's nasty.

I suppose one thing I could do is to ignore the error event completely
then and at the end of the other socket events check if there are any
errors and deal with it then.

But all of this seems like I'm really having to work around the (what
I'd say is) faulty behaviour of the socket class.  If the goal of having
the Error event fire as a background task is so that my "code can
realize that the socket is pretty much worthless at that point" then
some rethinking needs to be done.  Why? Because once the error event has
completed the event it overlapped continues where it was interrupted and
so doesn't "realize" anything.  I mean, if it's critical to realize the
state of the socket we already have the tools with the LastErrorCode and
IsConnected methods.

Thoughts?
jp
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to