Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
IPADDR_SOCKADDR(3)	   libdill Library Functions	    IPADDR_SOCKADDR(3)

NAME
       ipaddr_sockaddr	-  returns  sockaddr structure corresponding to	the IP
       address

SYNOPSIS
	      #include <libdill.h>

	      const struct sockaddr* ipaddr_sockaddr(
		  const	struct ipaddr* addr);

DESCRIPTION
       Returns sockaddr	structure corresponding	to the IP address.  This func-
       tion is typically used in combination with ipaddr_len to	 pass  address
       and its length to POSIX socket APIs.

       addr: IP	address	object.

       This  function  is  not	available  if  libdill is compiled with	--dis-
       able-sockets option.

RETURN VALUE
       Pointer to sockaddr structure correspoding to the address object.

ERRORS
       None.

EXAMPLE
	      ipaddr addr;
	      ipaddr_remote(&addr, "www.example.org", 80, 0, -1);
	      int s = socket(ipaddr_family(addr), SOCK_STREAM, 0);
	      connect(s, ipaddr_sockaddr(&addr), ipaddr_len(&addr));

SEE ALSO
       ipaddr_equal(3) ipaddr_family(3)	 ipaddr_len(3)	ipaddr_local(3)	 ipad-
       dr_port(3)  ipaddr_remote(3)  ipaddr_remotes(3) ipaddr_setport(3) ipad-
       dr_str(3)

libdill							    IPADDR_SOCKADDR(3)

Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=ipaddr_sockaddr&sektion=3&manpath=FreeBSD+Ports+15.0>

home | help