Sha256: e83752c859698550344b9f2e7a6f533405dc6c7f0ff6abcfd44b5b351686a309

Contents?: true

Size: 560 Bytes

Versions: 3

Compression:

Stored size: 560 Bytes

Contents

#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <errno.h>
#include "socket.h"
#include "byte.h"

long long socket_recv(int fd,unsigned char *x,long long xlen,unsigned char *ip,unsigned char *port)
{
  struct sockaddr_in sa;
  socklen_t salen;
  int r;

  if (xlen < 0) { errno = EPROTO; return -1; }
  if (xlen > 1048576) xlen = 1048576;

  byte_zero(&sa,sizeof sa);
  salen = sizeof sa;
  r = recvfrom(fd,x,xlen,0,(struct sockaddr *) &sa,&salen);
  byte_copy(ip,4,&sa.sin_addr);
  byte_copy(port,2,&sa.sin_port);
  return r;
}

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ruby_nacl-0.1.2 ext/ruby_nacl/NaCl/curvecp/socket_recv.c
ruby_nacl-0.1.1 ext/ruby_nacl/NaCl/curvecp/socket_recv.c
ruby_nacl-0.1.0 ext/ruby_nacl/NaCl/curvecp/socket_recv.c