This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Differences between nrf_socket.h and socket.h definitions

Is there a distinction in the functionality between the functions defined in nrf_socket.h and socket.h? For example, the functions nrf_socket and zsock_socket seem to do the same thing. The 'gps' sample code also seems to use the functions defined in socket.h to enable GPS and the nrf_socket.h functions to set up communications over a socket. Thanks!

  • Hi jlienau03,

    Please see Håkons explanation in this thread:

    - "you are mixing the nrf_socket.h and the zephyr socket API. They do not play well together and need translation (see nrf91_sockets.c for more detailed info).

    The include "net/socket.h" is also a bit suspicious, as you want to use the socket offloading, thus the translation between nrf and zephyr API. When you are calling socket() (and other calls), I am unsure which function you are calling in the background. This could be the network stacks socket implementation, which will not work with the nRF9160, or it could be the socket offloading (thus going into nrf91_sockets.c) which would have a mismatch of the structs."

Related