Apache Mesos
|
An abstraction around a socket (file descriptor). More...
#include <socket.hpp>
Public Types | |
enum | Shutdown { Shutdown::READ, Shutdown::WRITE, Shutdown::READ_WRITE } |
Public Member Functions | |
SocketImpl::Kind | kind () const |
Returns the kind representing the underlying implementation of the Socket instance. More... | |
bool | operator== (const Socket &that) const |
operator int_fd () const | |
Try< AddressType > | address () const |
Try< AddressType > | peer () const |
int_fd | get () const |
Try< AddressType > | bind (const AddressType &address) |
Try< Nothing > | listen (int backlog) |
Future< Socket > | accept () |
Future< Nothing > | connect (const AddressType &address) |
Future< size_t > | recv (char *data, size_t size) const |
Future< size_t > | send (const char *data, size_t size) const |
Future< size_t > | sendfile (int_fd fd, off_t offset, size_t size) const |
Future< std::string > | recv (const Option< ssize_t > &size=None()) |
Future< Nothing > | send (const std::string &data) |
Try< Nothing, SocketError > | shutdown (Shutdown shutdown=Shutdown::READ) |
operator Socket< network::Address > () const | |
template<> | |
Try< Socket< network::Address > > | create (SocketImpl::Kind kind)=delete |
template<> | |
Try< Socket< network::Address > > | create (Address::Family family, SocketImpl::Kind kind) |
template<> | |
Try< Socket< inet::Address > > | create (SocketImpl::Kind kind) |
template<> | |
Try< Socket< inet::Address > > | create (Address::Family family, SocketImpl::Kind kind)=delete |
template<> | |
Try< Socket< unix::Address > > | create (SocketImpl::Kind kind) |
template<> | |
Try< Socket< unix::Address > > | create (Address::Family family, SocketImpl::Kind kind)=delete |
Static Public Member Functions | |
static Try< Socket > | create (int_fd s, SocketImpl::Kind kind=SocketImpl::DEFAULT_KIND()) |
Returns an instance of a Socket using the specified kind of implementation. More... | |
static Try< Socket > | create (SocketImpl::Kind kind=SocketImpl::DEFAULT_KIND()) |
Returns an instance of a Socket using AddressType to determine the address family to use. More... | |
static Try< Socket > | create (Address::Family family, SocketImpl::Kind kind=SocketImpl::DEFAULT_KIND()) |
Returns an instance of a Socket using the specified Address::Family to determine the address family to use. More... | |
Friends | |
template<typename T > | |
class | Socket |
An abstraction around a socket (file descriptor).
Provides reference counting such that the socket is only closed (and thus, has the possibility of being reused) after there are no more references.
|
strong |
|
inline |
|
inline |
|
inline |
|
inline |
|
inlinestatic |
|
static |
Returns an instance of a Socket
using AddressType
to determine the address family to use.
An optional implementation kind can be specified. The NONBLOCK and CLOEXEC options will be set on the underlying file descriptor for the socket.
kind | Optional. The desired Socket implementation. |
Socket
.
|
static |
Returns an instance of a Socket
using the specified Address::Family
to determine the address family to use.
An optional implementation kind can be specified. The NONBLOCK and CLOEXEC options will be set on the underlying file descriptor for the socket.
NOTE: this is only defined for AddressType
of network::Address
, all others are explicitly deleted.
kind | Optional. The desired Socket implementation. |
Socket
.
|
delete |
|
inline |
|
inline |
|
delete |
|
inline |
|
delete |
|
inline |
|
inline |
Returns the kind representing the underlying implementation of the Socket
instance.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |