* [Bluez-devel] Reading data on two l2cap sockets
@ 2006-08-01 11:11 Mayank BATRA
2006-08-01 11:32 ` Filippo Giunchedi
0 siblings, 1 reply; 3+ messages in thread
From: Mayank BATRA @ 2006-08-01 11:11 UTC (permalink / raw)
To: BlueZ development
Hi,
I am listening on two l2cap sockets (on different PSMs) and then connecting to these two sockets.
I am using select() to get data on these two sockets.
fd_set readfds;
FD_ZERO(&readfds);
FD_SET(sk1, &readfds);
FD_SET(sk2, &readfds);
while(1) {
int ready = select(FD_SETSIZE, &readfds, 0, 0, 0);
if(ready == 0)
continue;
if(ready == -1 && errno != EINTR)
break;
if(FD_ISSET(sk1, &readfds)) {
fprintf(stderr, "Got something on sk1\n");
/* some code */
}
if(FD_ISSET(sk2, &readfds)) {
fprintf(stderr, "Got something on sk2\n");
/* some code */
}
}
Now, if I send data on sk1, the line "Got something on sk1" is printed, but if I send data on sk2, the line "Got something on sk2" is never printed.
Is there any contraint that both the l2cap sockets should be on the same PSM?
Regards,
Mayank
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Bluez-devel] Reading data on two l2cap sockets
2006-08-01 11:11 [Bluez-devel] Reading data on two l2cap sockets Mayank BATRA
@ 2006-08-01 11:32 ` Filippo Giunchedi
2006-08-01 11:56 ` Mayank BATRA
0 siblings, 1 reply; 3+ messages in thread
From: Filippo Giunchedi @ 2006-08-01 11:32 UTC (permalink / raw)
To: BlueZ development
[-- Attachment #1.1: Type: text/plain, Size: 632 bytes --]
On Tue, Aug 01, 2006 at 04:41:05PM +0530, Mayank BATRA wrote:
>
> Now, if I send data on sk1, the line "Got something on sk1" is printed, but if I send data on sk2, the line "Got something on sk2" is never printed.
I don't know the internals but you should really FD_SET readfds after every
select() invocation, i.e. move the readfds initialization inside the while loop.
filippo
--
Filippo Giunchedi - http://esaurito.net
PGP key: 0x6B79D401
random quote follows:
If there is any better use for being famous and respected than using
that status to question orthodoxy, I haven't found it yet.
-- Eric S. Raymond
[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
[-- Attachment #2: Type: text/plain, Size: 348 bytes --]
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
[-- Attachment #3: Type: text/plain, Size: 164 bytes --]
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Bluez-devel] Reading data on two l2cap sockets
2006-08-01 11:32 ` Filippo Giunchedi
@ 2006-08-01 11:56 ` Mayank BATRA
0 siblings, 0 replies; 3+ messages in thread
From: Mayank BATRA @ 2006-08-01 11:56 UTC (permalink / raw)
To: 'BlueZ development'
Filippo,
> I don't know the internals but you should really FD_SET
> readfds after every
> select() invocation, i.e. move the readfds initialization
> inside the while loop.
Thanks for your suggestions. It actually works!
I had been spending so much time figuring out why it does not work.
Regards,
Mayank
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2006-08-01 11:56 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-08-01 11:11 [Bluez-devel] Reading data on two l2cap sockets Mayank BATRA
2006-08-01 11:32 ` Filippo Giunchedi
2006-08-01 11:56 ` Mayank BATRA
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox