[haiku-development] Re: server connection

  • From: Donn Cave <donn@xxxxxxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Tue, 23 Nov 2010 09:29:15 -0800 (PST)

Quoth Ingo Weinhold <ingo_weinhold@xxxxxx>,
> On 2010-11-23 at 17:15:02 [+0100], Donn Cave <donn@xxxxxxxxxxx> wrote:
...
>> If he insists on using the IDLE feature, the client will be waiting
>> for unsolicited I/O, like a server, so he may need wait_for_objects()
>> in order to respond to application message events as well.
>
> That's what I was saying. :-) Often the only other event an explicit receiver 
> thread has to react to is the termination of the connection (or application), 
> though. Closing the socket accomplishes that without any extra provision, so 
> a blocking recv() should do just fine in such a case.

In an IDLE situation, you'll want to FETCH a message from your folder
or something, and at that point you need to wake up that recv and end
the IDLE, or at 29 minutes you need to end it anyway or risk server
timeout.  I suppose you could send the "DONE\r\n" response from another
thread, more or less as you might have closed the socket from another
thread, and then the recv will get the tagged server response.

Note that the server may have no way to know about receipt of messages,
other than to do its own polling at whatever interval the developer or
site admin thinks appropriate.  Mail is delivered to folders by sendmail
or the like, not imapd.  So for the extra trouble to support IDLE, it
isn't clear you will get notified about incoming mail any sooner.
Maybe it's different on other types of platforms where they don't
have imapd and sendmail, like Microsoft Exchange ... but I wouldn't
bet on Microsoft to get IDLE right, for some reason.

        Donn

Other related posts: