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 p, port;
         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)



                                       3                   qlibs:(socket_recv)

Man(1) output converted with man2html