24 #include <sys/types.h> 25 #include <sys/socket.h> 38 rv =
::read(handle.
fd(), buffer, size);
54 prefix_ unsigned senf::ReadablePolicy::do_readfrom(
FileHandle & handle,
char * buffer,
56 struct ::sockaddr * addr, socklen_t * len)
60 rv = ::recvfrom(handle.
fd(),buffer, size, 0, addr, len);
75 prefix_ unsigned senf::WriteablePolicy::do_write(
FileHandle & handle,
char const * buffer,
80 rv = ::write(handle.
fd(), buffer, size);
105 char const * buffer,
unsigned size,
106 struct sockaddr
const * addr, socklen_t len)
110 rv = ::sendto(handle.
fd(), buffer, size, 0, addr, len);
129 std::stringstream a, b;
130 senf::hexdump( reinterpret_cast<char const *>(addr) , reinterpret_cast<char const *>(addr + len), a);
131 senf::hexdump( buffer , buffer + size , b);
#define SENF_THROW_SYSTEM_EXCEPTION(desc)
Basic file handle wrapper.
ReadPolicy and WritePolicy public header.
int fd() const
Return the raw FileHandle.
static unsigned read(FileHandle &handle, char *buffer, unsigned size)
read data from socket