Thread (4 messages) flat view 4 messages, 2 authors, 2003-07-24

Re: [Bluez-devel] EBADFD on RFComm connect

From: Max Krasnyansky <hidden>
Date: 2003-07-24 17:38:23

At 07:09 AM 7/24/2003, Stephen Crane wrote:
On Wed, 2003-07-23 at 01:33, Max Krasnyansky wrote:
quoted
You can not do this
        while (0 > connect(s, (struct sockaddr *)&addr, sizeof(addr)))
               if (errno != EBUSY) {
                   perror("connect");
                   return -1;
               }

If connect returns EBUSY error you have to close() the socket. And it does
indeed return EBUSY in your case (I ran the progs) because close() is asynchronous
and that channel still exist (two connections on the same channel are not allowed 
in RFCOMM). What you can do to avoid that error is to enable SO_LINGER option on that
socket, in which case close() will be synchronous. 
Thanks Max. That's fixed it. Another one for the programming manual?
Yep.

Max
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help