Re: Fw: Question about the connect Function and BlueZ.

David Sainty
2009-08-24T21:19:46Z

Abraham J. Velez (EndoraSoft) wrote:
> Hi,
>
> The errno works but if the socket is NON-Blocking always is 115
> (EINPROGRESS).
>
> We need to know if the user has cancel the connexion or the connexion
> has broken by timeout.
>

Did you read what I sent? Especially the references to using poll() and
getsockopt()?

It sounds like your problem is solved by getting the final error code
from connect() non-blocking? And that's how you do it.

>>
>> Does this not work? From connect(2):
>>
>> EINPROGRESS
>> The socket is non-blocking and the connection cannot
>> be com-
>> pleted immediately. It is possible to select(2) or
>> poll(2) for
>> completion by selecting the socket for writing. After
>> select(2)
>> indicates writability, use getsockopt(2) to read the
>> SO_ERROR
>> option at level SOL_SOCKET to determine whether
>> connect() com-
>> pleted successfully (SO_ERROR is zero) or
>> unsuccessfully
>> (SO_ERROR is one of the usual error codes listed here,
>> explain-
>> ing the reason for the failure).
>>
>>