RFCOMM support for nonblocking sockets
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
Signature · 16 lines
Collin R. Mulliner <[email protected]> BETAVERSiON Systems [www.betaversion.net] info/pgp: finger [email protected] 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 [email protected] https://lists.sourceforge.net/lists/listinfo/bluez-devel
Marcel Holtmann
maintainerHi Collin,
Quoted 6 lines
does anybody know if
O_NONBLOCKis 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
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel
A message that is not in the archive (sent off-list or not yet received): 20040601190522.78ecb2d9@coredump
Marcel Holtmann
maintainerHi Collin,
Quoted 1 line
I'm on 2.6.6-mh2 (should be the newest) ...
since today it is -mh3, but that doesn't matters ;)
Quoted 9 lines
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.
Quoted 11 lines
psa.rc_family =
AF_BLUETOOTH;
psa.rc_channel = 0;// src ==
BDADDR_ANYif (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.
Quoted 2 lines
psa.rc_channel = 1;
psa.rc_bdaddr = dst;
Please try to use bacpy() to fill the rc_bdaddr.
Quoted 13 lines
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel