Sockets
- Updated2025-10-10
- 1 minute(s) read
After you configure the IP stacks as needed for your test, use the Socket API functions for TCP and/or UDP communication. The Socket API functions are designed to match the well-known Berkeley Sockets API (also known as BSD Sockets). The C APIs for Ethernet communication on Windows and Linux align with the Berkeley Sockets API. The alignment of these socket APIs is intended to reduce the learning curve and to facilitate re-use of code between stacks.
The header file for IP Stack and Sockets functions is named nxsocket.h (for more information, refer to Getting Started ).
Within nxsocket.h, the Berkeley Sockets functions, constants, and types use an nx prefix in order to avoid naming collisions with analogous Windows and Linux APIs. Other than this prefix, the Socket API uses the same naming as other Berkeley Sockets APIs. Consistent naming makes it easy to find the wealth of documentation and code on the Internet. For example, if you remove the prefix from the function nxlisten, and search the Internet for "socket listen", you can find descriptions and hints for using the listen function.
Find details for the following socket functions in the Automotive Ethernet Socket API for C Reference.
- nxaccept
- nxbind
- nxclose
- nxconnect
- nxfreeaddrinfo
- nxgetaddrinfo
- nxgetlasterrornum
- nxgetlasterrorstr
- nxgetnameinfo
- nxgetpeername
- nxgetsockname
- nxgetsockopt
- nxinet_addr
- nxinet_aton
- nxinet_ntoa
- nxinet_ntop
- nxinet_pton
- nxlisten
- nxrecv
- nxrecvfrom
- nxselect
- nxsend
- nxsendto
- nxsetsockopt
- nxshutdown
- nxsocket
- nxstrerr_r