qlibs:

Section: Misc. Reference Manual Pages (socket_recv)
Updated: 3
Index Return to Main Contents
 

NAME

socket_recv - receive UDP datagrams over IPv4/IPv6 connections  

SYNTAX

#include "socket_if.h"

int socket_recv(int s, const char *buf, unsigned int len,
                    const char ip[16], uint16 *port, uint32 *scope_id);  

DESCRIPTION

socket_recv reads len bytes starting at buf in a UDP datagram over the socket s while providing information about the remote IP address ip and the UDP port and the perhaps scope_id of the receiving interface.

You can call socket_recv without calling socket_bind. This has the effect as first calling socket_bind with IP address :: and port 0.  

RETURN VALUE

socket_recv returns 0, otherwise -1 and sets errno appropriately.  

EXAMPLE


  #include <socket_if.h>
  #include <ip.h>


  int s;
  char localip[16];
  char remoteip[16];
  uint16 pport;
  uint32 scope_id;
  unsigned int len;
  int r;
  char buf[MTUSIZE+1];


  s = socket_udp();
  socket_bind_reuse(s,localip,p,0);
  r = socket_recv(s,buf,len,remoteip,&port,&scope_id);  

SEE ALSO

socket_if(3), socket_info(3), socket_bind(3), socket_connect(3) socket_send(3), socket_setup(3), socket_tcp(3), socket_udp(3)


 

Index

NAME
SYNTAX
DESCRIPTION
RETURN VALUE
EXAMPLE
SEE ALSO

This document was created by man2html, using the manual pages.
Time: 14:55:39 GMT, December 15, 2024