Thread (4 messages) flat view 4 messages, 2 authors, 2009-08-24

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

From: David Sainty <hidden>
Date: 2009-08-24 21:19:46

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.
quoted
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).
  
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help