8 #ifndef FACEBOOK_NETWORK_SOCKET_H
9 #define FACEBOOK_NETWORK_SOCKET_H
56 static constexpr
SocketId invalidSocketId();
124 explicit inline operator bool()
const;
196 return INVALID_SOCKET;
207 inline Socket::operator bool()
const
209 return socketId_ != invalidSocketId();
This class implements a recursive lock object.
Definition: Lock.h:31
This class wraps an address number with 32 bits.
Definition: Address4.h:26
This class implements a network resource manager object for platforms that rely on specific network/s...
Definition: NetworkResource.h:27
This class wraps a port number with 16 bits.
Definition: Port.h:26
This class implements an address resolver.
Definition: Resolver.h:28
This class is the base class for all sockets.
Definition: Socket.h:31
Address4 address() const
Returns the own address of this socket.
virtual bool setAddress(const Address4 &address)
Sets the own address of this socket.
static bool setBlockingMode(const SocketId socketId, const bool blocking)
Sets the blocking mode of a socket.
SocketId socketId_
Socket id.
Definition: Socket.h:184
std::vector< uint8_t > Buffer
Definition of a vector holding 8 bit values.
Definition: Socket.h:76
bool setBlockingMode(const bool blocking)
Sets the blocking mode of this socket.
bool releaseSocket()
Releases the socket.
virtual bool onScheduler()
The scheduler event function.
NetworkResource networkResource_
The network resource object.
Definition: Socket.h:190
SOCKET SocketId
Definition of a socket id.
Definition: Socket.h:42
virtual ~Socket()
Destructs a socket object.
SocketResult
Definition of individual result values.
Definition: Socket.h:62
@ SR_BUSY
The function did not succeed as the resource was busy (not free, or would have blocked if configurate...
Definition: Socket.h:68
@ SR_FAILED
The function failed.
Definition: Socket.h:66
Socket()
Creates a new socket object.
Port port() const
Returns the own port of this socket.
Socket(const Socket &object)=delete
Disabled copy constructor.
Socket & operator=(const Socket &object)=delete
Disabled copy operator.
static constexpr SocketId invalidSocketId()
Returns an invalid socket id.
Definition: Socket.h:193
SocketId id() const
Returns the socket id.
Definition: Socket.h:202
size_t maximalMessageSize(const size_t defaultSize=65536)
Returns the maximal message size in bytes.
virtual bool setPort(const Port &port)
Sets the own port of this socket.
int SocketId
Definition of a socket id.
Definition: Socket.h:48
Lock lock_
Socket lock.
Definition: Socket.h:187
This class implements a high performance scheduler for socket events.
Definition: SocketScheduler.h:32
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15