How to become notified of BSD non-blocking events

Hi there,

I'm intending to use the nrfxlib modem library and its BSD socket implementation on the nRF9160. My goal is to use non-blocking APIs and use `nrf_poll` in response to various events.

For example, I'd like to use `nrf_recv` (1) with `NRF_O_NONBLOCK` and then receive a notification when there is data available given its respective file descriptor. To achieve this, I'm wondering if I can connect an IPC RECEIVE event with all IPC channels, which'd see that `nrf_poll` is then called by my code.

Thanks for any guidance here.

(1) https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrfxlib/nrf_modem/doc/api.html#group__nrf__socket__api_1ga1a288076f560857cb46fa0df46e1c7e5

Parents Reply Children
  • It is not that simple, unfortunately, as this event is used for all events coming from the modem. See the message sequences here for more details:

    I'm ok with that though... I'm just looking for an event that provides a reasonable excuse to call nrf_poll with a 0 timeout to find out about what, if anything, happened.

    I am unable to give a definite answer on your scenario in question, as its not a scenario that we've tested directly. What you're suggesting might work for a single-socket application, but I fear is problematic for multiple sockets scenario.

    nrf_poll should work for multiple sockets though...

    Which platform/language are you porting to?

    This is for use from the https://github.com/embassy-rs/embassy framework using Rust.

    Further to my questions here, is there any possibility that Nordic could open source the modem library and document the hardware interface of the modem? Thanks again.

  • Hi,

     

    Christopher Hunt said:
    nrf_poll should work for multiple sockets though...

    Yes, but if you have multiple poll() functions across different modules, it might be problematic.

    Christopher Hunt said:

    This is for use from the https://github.com/embassy-rs/embassy framework using Rust.

    Further to my questions here, is there any possibility that Nordic could open source the modem library and document the hardware interface of the modem? Thanks again.

    It is closed source, atleast for the time being. I'll input this internally as a feature request.

     

    Kind regards,

    Håkon

Related