Open GoogleCodeExporter opened 9 years ago
You'll like this, it's a /feature/ not a bug.
In order to reduce to one thread you receive events for every notification that
the PGM protocol requires for operation. This means many events and timeouts
are raised without receiving data.
If you want to *only* receive data you will have to implement an asynchronous
queue between the raw PGM socket and your application. An example is provided
with async.[ch] and one of the examples. The code is provided as an example so
it can be modified as required with limited expectation of support. Depending
on abstraction it may be possible to combine the threads together but it
depends on your event loop and pump.
I'll also add a reminder here that your senders also need to call pgm_recv()
and by definition will not receive data unless you are using a flat bus
topology. Your integration design determines how many threads you require.
This can be one thread for receiving, sending, the event queue, or one or more
for each.
--
Steve-o
Original comment by fnjo...@gmail.com
on 24 May 2012 at 4:41
Hi, Steve:
Thanks for your prompt reply.
The async.c code shows only one pgm_sock_t invovled.
What we are trying to achieve is to use ONE single thread to receive data from
MULTIPLE pgm_sock_t, plus a few linux PIPEs.
Any advices ?
Thanks,
Frank
Original comment by frankxie...@gmail.com
on 24 May 2012 at 5:22
I like to restate my original question in case there is any mis-understanding.
Let's there are 1 pgm_sockets, s1 (set blocking mode), there is pipes : p1
There is a variable FD_SET readset.
readset is set correcly to include s1, p1.
now I do select(nfds, &readset, NULL, NULL, NULL ).
Here is the issue I was trying to describe in my original post:
case 1, if there is NO data pending on pgmsocket s1 AND there is data pending
on p1, the select return with correct bit set in readset.
case 2, if there IS data pending on pgmsocket s1 AND there IS data pending on
p1, the select return with ONLY bits set for s1, not bit set for p1.
I am trying to understand why case2 happens.
Thanks,
Frank
Original comment by frankxie...@gmail.com
on 24 May 2012 at 8:10
This is reading more confusing. How about an example code to demonstrate?
Original comment by fnjo...@gmail.com
on 2 Jun 2012 at 2:18
Original issue reported on code.google.com by
frankxie...@gmail.com
on 24 May 2012 at 4:30