Re: Clients and threads
From: Jakob Schroeter <js@xxxxxxxxxx>
Date: Wed, 14 Feb 2007 19:17:53 +0100 (CET)
Hi,

On Wed Feb 14 2007, Anatoly Gutnick wrote:
>  I would like to use non blocking connect instead of polling required for
> blocking.
> And it means to send() in SenderThread and to receive() in RecieverThread.
>
> Gloox opens *one* socket for send() and receive().
>
> I found such posts, but not in officional Microsoft's docs:
>
> "One thread calling send() and another thread calling recv() on a single
> socket is safe on recent Microsoft stacks at least"
>
>
> So, is it possible to use gloox to send and recv using non bloking connect?

If you have to use threads, your best bet is probably to use mutexes to 
synchronise send() and recv() calls. That is, you would use non-blocking 
connect and acquire a mutex before each call to recv(), and release it 
afterwards. You would also acquire a mutex before calling send(), directly or 
indirectly, and release it afterwards.
Or something like that.

cheers,
Jakob

Attachment: pgp5a5AsBf8m6.pgp
Description: PGP signature