Any other option to send and receive using gloox and to avoid poling?
From: "Anatoly Gutnick" <anatolyg@xxxxxxxxx>
Date: Wed, 14 Feb 2007 20:24:08 +0100 (CET)
Sorry, my mistake in the question.

I would like to avoid pooling, so i want to use bloking connect and two
threads.

ReaderThread open blocking connect() ( and connect wait on recv() as i see).
WriterThread uses send().

One thread calling send() and another thread calling recv() on a single
socket.... Not sure it is save.

*Any other option to send and receive using gloox and to avoid poling**?*

Thanks,
Anatoly






2007/2/14, Jakob Schroeter <js@xxxxxxxxxx>:

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

--
gloox-dev mailing list
to unsubscribe:
send a message with subject 'unsubscribe gloox-dev' to
minimalist@xxxxxxxxxx