Revision e44ff2bb

View differences:

src/Chunkiser/input-stream-udp.c
4 4
 *  This is free software; see gpl-3.0.txt
5 5
 */
6 6
#include <sys/time.h>
7
#ifndef _WIN32
7 8
#include <sys/socket.h>
8 9
#include <netinet/in.h>
10
#else
11
#include <winsock2.h>
12
#endif
9 13
#include <unistd.h>
10 14
#include <stdlib.h>
11 15
#include <stdint.h>
......
36 40
{
37 41
  ssize_t msglen;
38 42

  
39
  msglen = recv(fd, data, UDP_BUF_SIZE, MSG_DONTWAIT);
43
  msglen = recv(fd, data, UDP_BUF_SIZE, 0);
40 44
  if (msglen <= 0) {
41 45
    return 0;
42 46
  }
......
55 59
    return -1;
56 60
  }
57 61

  
62
#ifndef _WIN32
63
  fcntl(fd, F_SETFL, O_NONBLOCK);
64
#else
65
  {
66
    unsigned long nonblocking = 1;
67
    ioctlsocket(fd, FIONBIO, (unsigned long*) &nonblocking);
68
  }
69
#endif
70

  
58 71
  memset(&servaddr, 0, sizeof(servaddr));
59 72
  servaddr.sin_family = AF_INET;
60 73
  servaddr.sin_addr.s_addr = htonl(INADDR_ANY);
src/Chunkiser/output-stream-udp.c
3 3
 *
4 4
 *  This is free software; see gpl-3.0.txt
5 5
 */
6
#ifndef _WIN32
6 7
#include <sys/socket.h>
7 8
#include <netinet/in.h>
8 9
#include <arpa/inet.h>
10
#else
11
#include <winsock2.h>
12
#endif
9 13
#include <unistd.h>
10 14
#include <stdint.h>
11 15
#include <limits.h>
......
20 24

  
21 25
#define UDP_PORTS_NUM_MAX 10
22 26

  
27
#ifdef _WIN32
28
static int inet_aton(const char *cp, struct in_addr *addr)
29
{
30
    if( cp==NULL || addr==NULL )
31
    {
32
        return(0);
33
    }
34

  
35
    addr->s_addr = inet_addr(cp);
36
    return (addr->s_addr == INADDR_NONE) ? 0 : 1;
37
}
38
#endif
39

  
23 40
struct dechunkiser_ctx {
24 41
  int outfd;
25 42
  char ip[16];

Also available in: Unified diff