public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
* Question about the connect Function and BlueZ.
@ 2009-08-22 16:51 Abraham J. Velez (EndoraSoft)
  2009-08-22 19:59 ` Marcel Holtmann
  0 siblings, 1 reply; 2+ messages in thread
From: Abraham J. Velez (EndoraSoft) @ 2009-08-22 16:51 UTC (permalink / raw)
  To: linux-bluetooth

Hi,

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...

-------------------------------------------------------------------------------------------------------------------------------------------------------------
fcntl(handlesocket, F_SETFL, fcntl(handlesocket, F_GETFL,0) & ~O_NONBLOCK);
shutdown(handlesocket,SHUT_RDWR);
close(handlesocket);
handlesocket = -1;
-------------------------------------------------------------------------------------------------------------------------------------------------------------

The same code in Microsoft Windows Stack of Bluetooth "cancel" the connect 
function...

Any idea?

Thanks in advanced for your time ....

Best Regards,
Abraham. 



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-08-22 19:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-22 16:51 Question about the connect Function and BlueZ Abraham J. Velez (EndoraSoft)
2009-08-22 19:59 ` Marcel Holtmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox