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

FreeBSD Manual Pages

  
 
  

home | help
socket_recv6(3)		   Library Functions Manual	       socket_recv6(3)

NAME
       socket_recv6 - receive a	UDP datagram

SYNTAX
       #include	<socket.h>

       ssize_t socket_recv6(int	s, char* buf, size_t len,
	       char ip[16], uint16* port, uint32* scope_id);

DESCRIPTION
       socket_recv6  receives up to len	bytes starting at buf from a UDP data-
       gram coming in on the socket s.	It writes the UDP port to port and the
       IP address to ip, and returns the number	of bytes actually received (or
       -1 if anything went wrong).

       For link-local addresses, scope_id will become  the  network  interface
       number, which can be translated into the	name of	the interface ("eth0")
       with socket_getifname.

RETURN VALUE
       socket_recv6 returns the	number of bytes	in the datagram	if one was re-
       ceived.	If not,	it returns -1 and sets errno appropriately.

EXAMPLE
	 #include <socket.h>

	 int s;
	 char ip[16];
	 uint16	p;
	 char buf[1000];
	 int len;
	 uint32	scope_id;

	 s = socket_tcp4();
	 socket_bind6(s,ip,p);
	 len = socket_recv6(s,buf,sizeof(buf),ip,&p,&scope_id);

SEE ALSO
       socket_recv4(3),	socket_getifname(3)

							       socket_recv6(3)

NAME | SYNTAX | DESCRIPTION | RETURN VALUE | EXAMPLE | SEE ALSO

Want to link to this manual page? Use this URL:
<https://www.freebsd.org/cgi/man.cgi?query=libowfat_socket_recv6&sektion=3&manpath=FreeBSD+13.0-RELEASE+and+Ports>

home | help