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));
ssize_t recv(void *buf, size_t n, struct timeval *tv)
int set_option(int level, int option, void *optval, int optlen) const
int get_local_addr(sockaddr &)
ssize_t recv_n(void *buf, size_t n)
int get_option(int level, int option, void *optval, int *optlen) const
TcpStream()
Constructor TcpStream.
int get_remote_addr(sockaddr &)
ssize_t send_n(const void *buf, size_t n, struct timeval *tv)
virtual ~TcpStream()
Destructor ~TcpStream.
ssize_t recv(void *buf, size_t n)
ssize_t recv_n(void *buf, size_t n, struct timeval *tv)
ssize_t send_n(const void *buf, size_t n)
The main, catch-all namespace for YARP.