10 #ifndef YARP_OS_IMPL_POSIX_TCPSTREAM_H
11 #define YARP_OS_IMPL_POSIX_TCPSTREAM_H
14 #include <sys/types.h>
15 #include <sys/socket.h>
16 #include <netinet/in.h>
17 #include <arpa/inet.h>
48 return ::recv(sd, buf, n, 0);
53 setsockopt(sd, SOL_SOCKET, SO_RCVTIMEO,
reinterpret_cast<char *
>(tv),
sizeof (*tv));
54 return ::recv(sd, buf, n, 0);
59 return ::recv(sd, buf, n, 0);
64 setsockopt(sd, SOL_SOCKET, SO_RCVTIMEO,
reinterpret_cast<char *
>(tv),
sizeof (*tv));
65 return ::recv(sd, buf, n, 0);
70 return ::send(sd, buf, n, 0);
75 setsockopt(sd, SOL_SOCKET, SO_SNDTIMEO,
reinterpret_cast<char *
>(tv),
sizeof (*tv));
76 return ::send(sd, buf, n, 0);
85 ::shutdown(sd, SHUT_RD);
92 ::shutdown(sd, SHUT_WR);
117 inline int set_option(
int level,
int option,
void *optval,
int optlen)
const
119 return setsockopt(sd, level, option,
static_cast<char*
>(optval), optlen);
123 inline int get_option(
int level,
int option,
void *optval,
int *optlen)
const
125 return getsockopt(sd, level, option,
static_cast<char*
>(optval),
reinterpret_cast<socklen_t*
>(optlen));
137 #endif // YARP_OS_IMPL_POSIX_TCPSTREAM_H