Go to the documentation of this file.
50 #include <sys/types.h>
57 #include <arpa/inet.h>
61 #include <netinet/in.h>
62 #include <netinet/tcp.h>
70 #define getpid _getpid
71 #define ROS_INVALID_SOCKET INVALID_SOCKET
72 #define ROS_SOCKETS_SHUT_RDWR SD_BOTH
73 #define ROS_SOCKETS_ASYNCHRONOUS_CONNECT_RETURN WSAEWOULDBLOCK
75 #define POLLRDNORM 0x0100
78 #define POLLRDBAND 0x0200
81 #define POLLIN (POLLRDNORM | POLLRDBAND)
84 #define POLLPRI 0x0400
88 #define POLLWRNORM 0x0010
91 #define POLLOUT (POLLWRNORM)
94 #define POLLWRBAND 0x0020
97 #define POLLERR 0x0001
100 #define POLLHUP 0x0002
103 #define POLLNVAL 0x0004
106 #define ROS_SOCKETS_SHUT_RDWR SHUT_RDWR
107 #define ROS_INVALID_SOCKET ((int) -1)
108 #define ROS_SOCKETS_ASYNCHRONOUS_CONNECT_RETURN EINPROGRESS
131 typedef unsigned long int nfds_t;
173 #ifdef WIN32 // use a socket pair
174 ::closesocket(signal_pair[0]);
175 ::closesocket(signal_pair[1]);
176 #else // use a socket pair on mingw or pipe pair on linux, either way, close works
177 ::close(signal_pair[0]);
178 ::close(signal_pair[1]);
189 return ::send(signal, buffer, nbyte, 0);
194 return write(signal, buffer, nbyte);
206 return ::recv(signal, buffer, nbyte, 0);
211 return read(signal, buffer, nbyte);
const ROSCPP_DECL char * socket_error_string(int err)
ROSCPP_DECL int create_signal_pair(signal_fd_t signal_pair[2])
ROSCPP_DECL int is_async_connected(socket_fd_t &socket, int &err)
ROSCPP_DECL pollfd_vector_ptr poll_sockets(int epfd, socket_pollfd *fds, nfds_t nfds, int timeout)
A cross platform polling function for sockets.
ssize_t read_signal(const signal_fd_t &signal, void *buffer, const size_t &nbyte)
void close_signal_pair(signal_fd_t signal_pair[2])
ssize_t write_signal(const signal_fd_t &signal, const void *buffer, const size_t &nbyte)
ROSCPP_DECL void close_socket_watcher(int fd)
ROSCPP_DECL void del_socket_from_watcher(int epfd, int fd)
ROSCPP_DECL bool last_socket_error_is_would_block()
ROSCPP_DECL void add_socket_to_watcher(int epfd, int fd)
ROSCPP_DECL int last_socket_error()
ROSCPP_DECL int close_socket(socket_fd_t &socket)
Close the socket.
boost::shared_ptr< std::vector< socket_pollfd > > pollfd_vector_ptr
struct pollfd socket_pollfd
ROSCPP_DECL void set_events_on_socket(int epfd, int fd, int events)
ROSCPP_DECL int set_non_blocking(socket_fd_t &socket)
const ROSCPP_DECL char * last_socket_error_string()
ROSCPP_DECL int create_socket_watcher()
roscpp
Author(s): Morgan Quigley, Josh Faust, Brian Gerkey, Troy Straszheim, Dirk Thomas
, Jacob Perron
autogenerated on Sat Sep 14 2024 02:59:35