Re: Question about the connect Function and BlueZ.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Abraham,

> Well, we have a problem in the Linux platfform with BlueZ. The problem is 
> easy to explain:
> 
> We open a connexion (with bluetooth) with connect function (we use socket). 
> Every connexion make in his own thread. This connexions are with Obex Push 
> profile. This works without problems.
> 
> For the purposes of our applications, we need to cut this connection before 
> the terminal (reduced the time of the ask in the terminal: the user confirm 
> the sending). The call to connect function is blocking (because we need to 
> know if the user of the terminal can not connect errno==ECONNREFUSED).
> 
> 
> -------------------------------------------------------------------------------------------------------------------------------------------------------------
> fcntl(func->handlesocket, F_SETFL, fcntl(func->handlesocket, F_GETFL,0) & 
> ~O_NONBLOCK);
> func->refused = false;
> error = connect(func->handlesocket, (struct sockaddr *)&rem_addr, 
> sizeof(rem_addr));
> if(error<0)
>   {
>     if(errno==ECONNREFUSED) func->refused = true;
>     func->SetEvent(DIOLNXBTFSMEVENT_DISCONNECTING);
>     break;
>   }
> ------------------------------------------------------------------------------------------------------------------------------------------------------------
> 
> The problem is: How cancel this block connexion make with connect function?
> 
> If we call to this code (in other thread) the connect function waits to 
> timeout of the terminal...

the problem seems similar or the same to what Nick posted a view weeks
ago. If you use blocking connect() in one thread the close() in another
thread will not terminate the connection attempt. As far as I can tell
this is true and should be fixed. It however works fine if you just
would use proper non-blocking connect() with a mainloop.

Regards

Marcel


--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux