#include <gr_udp_sink.h>
#include <gr_io_signature.h>
#include <stdexcept>
+#if defined(HAVE_SOCKET)
#include <netdb.h>
+typedef void* optval_t;
+#else
+#define SHUT_RDWR 2
+#define inet_aton(N,A) ( (A)->s_addr = inet_addr(N), ( (A)->s_addr != INADDR_NONE ) )
+typedef char* optval_t;
+#endif
#define SNK_VERBOSE 0
// Turn on reuse address
int opt_val = true;
- if(setsockopt(d_socket, SOL_SOCKET, SO_REUSEADDR, (void*)&opt_val, sizeof(int)) == -1) {
+ if(setsockopt(d_socket, SOL_SOCKET, SO_REUSEADDR, (optval_t)&opt_val, sizeof(int)) == -1) {
perror("SO_REUSEADDR");
throw std::runtime_error("can't set socket option SO_REUSEADDR");
}
linger lngr;
lngr.l_onoff = 1;
lngr.l_linger = 0;
- if(setsockopt(d_socket, SOL_SOCKET, SO_LINGER, (void*)&lngr, sizeof(linger)) == -1) {
+ if(setsockopt(d_socket, SOL_SOCKET, SO_LINGER, (optval_t)&lngr, sizeof(linger)) == -1) {
perror("SO_LINGER");
throw std::runtime_error("can't set socket option SO_LINGER");
}
#include <gr_sync_block.h>
#include <omnithread.h>
+#if defined(HAVE_SOCKET)
#include <sys/socket.h>
#include <arpa/inet.h>
-#include <sys/socket.h>
+#elif defined(HAVE_WINDOWS_H)
+#include <winsock2.h>
+#include <windows.h>
+#endif
#if defined(HAVE_NETINET_IN_H)
#include <netinet/in.h>
#endif
#include <gr_io_signature.h>
#include <stdexcept>
#include <errno.h>
+#if defined(HAVE_SOCKET)
#include <netdb.h>
+typedef void* optval_t;
+#else
+#define SHUT_RDWR 2
+#define inet_aton(N,A) ( (A)->s_addr = inet_addr(N), ( (A)->s_addr != INADDR_NONE ) )
+typedef char* optval_t;
+#endif
#define SRC_VERBOSE 0
// Turn on reuse address
int opt_val = 1;
- if(setsockopt(d_socket, SOL_SOCKET, SO_REUSEADDR, (void*)&opt_val, sizeof(int)) == -1) {
+ if(setsockopt(d_socket, SOL_SOCKET, SO_REUSEADDR, (optval_t)&opt_val, sizeof(int)) == -1) {
perror("SO_REUSEADDR");
throw std::runtime_error("can't set socket option SO_REUSEADDR");
}
linger lngr;
lngr.l_onoff = 1;
lngr.l_linger = 0;
- if(setsockopt(d_socket, SOL_SOCKET, SO_LINGER, (void*)&lngr, sizeof(linger)) == -1) {
+ if(setsockopt(d_socket, SOL_SOCKET, SO_LINGER, (optval_t)&lngr, sizeof(linger)) == -1) {
perror("SO_LINGER");
throw std::runtime_error("can't set socket option SO_LINGER");
}
timeval timeout;
timeout.tv_sec = 1;
timeout.tv_usec = 0;
- if(setsockopt(d_socket, SOL_SOCKET, SO_RCVTIMEO, (void*)&timeout, sizeof(timeout)) == -1) {
+ if(setsockopt(d_socket, SOL_SOCKET, SO_RCVTIMEO, (optval_t)&timeout, sizeof(timeout)) == -1) {
perror("SO_RCVTIMEO");
throw std::runtime_error("can't set socket option SO_RCVTIMEO");
}
#include <gr_sync_block.h>
#include <omnithread.h>
+#if defined(HAVE_SOCKET)
#include <sys/socket.h>
#include <arpa/inet.h>
+#elif defined(HAVE_WINDOWS_H)
+#include <winsock2.h>
+#include <windows.h>
+#endif
#if defined(HAVE_NETINET_IN_H)
#include <netinet/in.h>
#endif
%{
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include <gr_file_sink.h>
#include <gr_file_source.h>
#include <gr_file_descriptor_sink.h>