* [Bluez-devel] RFCOMM support for nonblocking sockets @ 2004-06-01 16:32 Collin R. Mulliner 2004-06-01 16:41 ` Marcel Holtmann 0 siblings, 1 reply; 3+ messages in thread From: Collin R. Mulliner @ 2004-06-01 16:32 UTC (permalink / raw) To: bluez-devel Hi, does anybody know if O_NONBLOCK is supported for RFCOMM? I allways get "errno == 11" and perror tells me "Resource temporarily unavailable" If I don't do: fcntl(sock, F_SETFL, O_NONBLOCK) the code works fine. thanks ... Collin -- Collin R. Mulliner <collin@betaversion.net> BETAVERSiON Systems [www.betaversion.net] info/pgp: finger collin@betaversion.net USS Enterprise Bumperstricker: Our other starship separates into 3 pieces! ------------------------------------------------------- This SF.Net email is sponsored by: Oracle 10g Get certified on the hottest thing ever to hit the market... Oracle 10g. Take an Oracle 10g class now, and we'll give you the exam FREE. http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click _______________________________________________ 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] RFCOMM support for nonblocking sockets 2004-06-01 16:32 [Bluez-devel] RFCOMM support for nonblocking sockets Collin R. Mulliner @ 2004-06-01 16:41 ` Marcel Holtmann [not found] ` <20040601190522.78ecb2d9@coredump> 0 siblings, 1 reply; 3+ messages in thread From: Marcel Holtmann @ 2004-06-01 16:41 UTC (permalink / raw) To: Collin R. Mulliner; +Cc: BlueZ Mailing List Hi Collin, > does anybody know if O_NONBLOCK is supported for RFCOMM? > > I allways get "errno == 11" and > perror tells me "Resource temporarily unavailable" > > If I don't do: fcntl(sock, F_SETFL, O_NONBLOCK) the code works fine. the non-blocking support should work. What kernel version do you? Show us your code. Regards Marcel ------------------------------------------------------- This SF.Net email is sponsored by: Oracle 10g Get certified on the hottest thing ever to hit the market... Oracle 10g. Take an Oracle 10g class now, and we'll give you the exam FREE. http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click _______________________________________________ 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
[parent not found: <20040601190522.78ecb2d9@coredump>]
* Re: [Bluez-devel] RFCOMM support for nonblocking sockets [not found] ` <20040601190522.78ecb2d9@coredump> @ 2004-06-01 17:25 ` Marcel Holtmann 0 siblings, 0 replies; 3+ messages in thread From: Marcel Holtmann @ 2004-06-01 17:25 UTC (permalink / raw) To: Collin R. Mulliner; +Cc: BlueZ Mailing List Hi Collin, > I'm on 2.6.6-mh2 (should be the newest) ... since today it is -mh3, but that doesn't matters ;) > the code is: > > sock = socket(PF_BLUETOOTH, SOCK_STREAM, BTPROTO_RFCOMM); > > if (sock >= 0) { > if (fcntl(sock, F_SETFL, O_NONBLOCK) != 0) { > perror("fcntl()"); > } > } I don't know if this is the problem, but set the socket to non-blocking after the bind() and the setsockopt() calls. > psa.rc_family = AF_BLUETOOTH; > psa.rc_channel = 0; > > // src == BDADDR_ANY > if (bacmp(&src, BDADDR_ANY) != 0) { > psa.rc_bdaddr = src; > if (bind(sock, (struct sockaddr *)&psa, sizeof(psa)) < 0) { > perror("Can't bind()"); > return(-1); > } > } This check is not needed, because you can bind also src == BDADDR_ANY. > psa.rc_channel = 1; > psa.rc_bdaddr = dst; Please try to use bacpy() to fill the rc_bdaddr. > go: > if (connect(sock, (struct sockaddr *)&psa, sizeof(psa)) != 0) { > if(errno == EINPROGRESS) { > // never reached! > pf[0].fd = sock; > pf[0].events = POLLOUT; > poll(pf, 1, -1); > goto go; > } > else { > perror("Connect()"); > // allways prints "Resource temporarily unavailable" > } Run "hcidump -x" to see what is going on. Print out the errno. Regards Marcel ------------------------------------------------------- This SF.Net email is sponsored by: Oracle 10g Get certified on the hottest thing ever to hit the market... Oracle 10g. Take an Oracle 10g class now, and we'll give you the exam FREE. http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click _______________________________________________ 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:[~2004-06-01 17:25 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-06-01 16:32 [Bluez-devel] RFCOMM support for nonblocking sockets Collin R. Mulliner
2004-06-01 16:41 ` Marcel Holtmann
[not found] ` <20040601190522.78ecb2d9@coredump>
2004-06-01 17:25 ` Marcel Holtmann
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox