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_id | Pointer to a variable that will receive the socket ID opened from this function. |
p_remote_host_name | IP address contained in the address. |
remote_port_nbr | Port 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. |
p_err | Pointer 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.
- Obviously DNS must be present and enabled in the project to be possible.
- The ip_family argument let the application choose the IP family of the addresses returned by the DNS resolution.
- 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.