NetApp_ClientDatagramOpenByHostname

Open a datagram type (UDP) socket to the server using its host name.(select IP address automatically):

Files

net_app.h/net_app.c

Prototype

 

NET_IP_ADDR_FAMILY  NetApp_ClientDatagramOpenByHostname (NET_SOCK_ID         *p_sock_id,
                                                         CPU_CHAR            *p_remote_host_name,
                                                         NET_PORT_NBR         remote_port_nbr,
                                                         NET_IP_ADDR_FAMILY   ip_family,
                                                         NET_SOCK_ADDR       *p_sock_addr,
                                                         CPU_BOOLEAN         *p_is_hostname,
                                                         NET_ERR             *p_err);

 

Arguments

p_sock_idPointer to a variable that will receive the socket ID opened from this function.
p_remote_host_nameIP address contained in the address.
remote_port_nbrPort of the remote host.
ip_family

Select IP family of addresses returned by DNS resolution.

NET_IP_ADDR_FAMILY_IPv4

NET_IP_ADDR_FAMILY_IPv6

p_sock_addr

Pointer to the secure configuration (TLS/SSL):

DEF_NULL, if no security enabled.

Pointer to a structure that contains the TLS/SSL parameters, if the TLS/SSL must be active on the connection.

p_is_hostname

Pointer to variable that will received the boolean to indicate if the string passed in p_remote_host_name was a hostname or a IP address.

DEF_YES, hostanme was received.
DEF_NO, otherwise.

p_errPointer to variable that will receive the return error code from this function.

Returned Value

NET_IP_ADDR_FAMILY_IPv4, if the opening was successful using an IPv4 address.

NET_IP_ADDR_FAMILY_IPv6, if the opening was successful using an IPv6 address.

NET_IP_ADDR_FAMILY_UNKNOWN, otherwise.

Required Configuration

None.

Notes / Warnings

When a host name is passed into the remote host name parameter, this function will try to resolve the address of the remote host using DNS.

  1. Obviously DNS must be present and enabled in the project to be possible.
  2. The ip_family argument let the application choose the IP family of the addresses returned by the DNS resolution.
  3. This function always block, and the fail timeout depend of the DNS resolution timeout, the number of remote address found and the connection timeout parameter.