Zephyr API Documentation 4.0.99
A Scalable Open Source RTOS
 4.0.99
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
socketutils.h File Reference

Socket utility functions. More...

Go to the source code of this file.

Functions

const char * net_addr_str_find_port (const char *addr_str)
 Find port in addr:port string.
 
int net_getaddrinfo_addr_str (const char *addr_str, const char *def_port, const struct zsock_addrinfo *hints, struct zsock_addrinfo **res)
 Call getaddrinfo() on addr:port string.
 

Detailed Description

Socket utility functions.

Function Documentation

◆ net_addr_str_find_port()

const char * net_addr_str_find_port ( const char * addr_str)

Find port in addr:port string.

Parameters
addr_strString of addr[:port] format
Returns
Pointer to "port" part, or NULL is none.

◆ net_getaddrinfo_addr_str()

int net_getaddrinfo_addr_str ( const char * addr_str,
const char * def_port,
const struct zsock_addrinfo * hints,
struct zsock_addrinfo ** res )

Call getaddrinfo() on addr:port string.

Convenience function to split addr[:port] string into address vs port components (or use default port number), and call getaddrinfo() on the result.

Parameters
addr_strString of addr[:port] format
def_portDefault port number to use if addr_str doesn't contain it
hintsgetaddrinfo() hints
resResult of getaddrinfo() (freeaddrinfo() should be called on it as usual.
Returns
Result of getaddrinfo() call.