7 #ifndef YARP_OS_IMPL_POSIX_TCPSTREAM_H
8 #define YARP_OS_IMPL_POSIX_TCPSTREAM_H
11 #include <sys/types.h>
12 #include <sys/socket.h>
13 #include <netinet/in.h>
14 #include <arpa/inet.h>
45 return ::recv(sd, buf, n, 0);
50 setsockopt(sd, SOL_SOCKET, SO_RCVTIMEO,
reinterpret_cast<char *
>(tv),
sizeof (*tv));
51 return ::recv(sd, buf, n, 0);
56 return ::recv(sd, buf, n, 0);
61 setsockopt(sd, SOL_SOCKET, SO_RCVTIMEO,
reinterpret_cast<char *
>(tv),
sizeof (*tv));
62 return ::recv(sd, buf, n, 0);
67 return ::send(sd, buf, n, 0);
72 setsockopt(sd, SOL_SOCKET, SO_SNDTIMEO,
reinterpret_cast<char *
>(tv),
sizeof (*tv));
73 return ::send(sd, buf, n, 0);
82 ::shutdown(sd, SHUT_RD);
89 ::shutdown(sd, SHUT_WR);
114 inline int set_option(
int level,
int option,
void *optval,
int optlen)
const
116 return setsockopt(sd, level, option,
static_cast<char*
>(optval), optlen);
120 inline int get_option(
int level,
int option,
void *optval,
int *optlen)
const
122 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.