BSD Library nrf_connect() results an EINPROGRESS error when non blocking is enabled

Hi, 

Is it expected to get an EINPROGRESS error when calling nrf_connect() with NRF_O_NONBLOCK set. How do I know if the call was successful or not? Should I expect a positive result from nrf_poll()?

By the way our firmware is running on a custom OS and preferred non blocking calls in this current situation. 

Thank you. 

mcGyver

  • Hi,

     

    I can confirm that the behavior is to return NRF_EINPROGRESS with O_NONBLOCK configured in fcntl().

    For connect, this is the intended behavior, per the "man connect":

           EINPROGRESS
                  The socket is nonblocking and the connection cannot be
                  completed immediately.  (UNIX domain sockets failed with
                  EAGAIN instead.)  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() completed successfully (SO_ERROR is zero) or
                  unsuccessfully (SO_ERROR is one of the usual error codes
                  listed here, explaining the reason for the failure).

     

    EINPROGRESS (or possible EAGAIN) should be expected for connect().

     

    Kind regards,

    Håkon