Ocean
Ocean::Network::Server Class Reference

This class is the base class for all server. More...

Inheritance diagram for Ocean::Network::Server:

Public Member Functions

 ~Server () override
 Destructs a server object. More...
 
virtual bool start ()
 Starts the server. More...
 
virtual bool stop ()
 Stops the server. More...
 
- Public Member Functions inherited from Ocean::Network::Socket
virtual ~Socket ()
 Destructs a socket object. More...
 
SocketId id () const
 Returns the socket id. More...
 
Address4 address () const
 Returns the own address of this socket. More...
 
Port port () const
 Returns the own port of this socket. More...
 
virtual bool setAddress (const Address4 &address)
 Sets the own address of this socket. More...
 
virtual bool setPort (const Port &port)
 Sets the own port of this socket. More...
 
 operator bool () const
 Returns whether this socket is valid. More...
 

Protected Member Functions

 Server ()
 Creates a new server object. More...
 
- Protected Member Functions inherited from Ocean::Network::Socket
 Socket ()
 Creates a new socket object. More...
 
 Socket (const Socket &object)=delete
 Disabled copy constructor. More...
 
bool setBlockingMode (const bool blocking)
 Sets the blocking mode of this socket. More...
 
size_t maximalMessageSize (const size_t defaultSize=65536)
 Returns the maximal message size in bytes. More...
 
bool releaseSocket ()
 Releases the socket. More...
 
virtual bool onScheduler ()
 The scheduler event function. More...
 
Socketoperator= (const Socket &object)=delete
 Disabled copy operator. More...
 

Protected Attributes

Buffer buffer_
 The socket buffer of this server. More...
 
bool schedulerIsActive_ = false
 True, if the server scheduler is active. More...
 
- Protected Attributes inherited from Ocean::Network::Socket
SocketId socketId_ = invalidSocketId()
 Socket id. More...
 
Lock lock_
 Socket lock. More...
 
NetworkResource networkResource_
 The network resource object. More...
 

Additional Inherited Members

- Public Types inherited from Ocean::Network::Socket
enum  SocketResult { SR_SUCCEEDED = 0 , SR_FAILED , SR_BUSY , SR_NOT_CONNECTED }
 Definition of individual result values. More...
 
typedef SOCKET SocketId
 Definition of a socket id. More...
 
typedef int SocketId
 Definition of a socket id. More...
 
typedef std::vector< uint8_t > Buffer
 Definition of a vector holding 8 bit values. More...
 
- Static Public Member Functions inherited from Ocean::Network::Socket
static constexpr SocketId invalidSocketId ()
 Returns an invalid socket id. More...
 
static bool setBlockingMode (const SocketId socketId, const bool blocking)
 Sets the blocking mode of a socket. More...
 

Detailed Description

This class is the base class for all server.

Constructor & Destructor Documentation

◆ ~Server()

Ocean::Network::Server::~Server ( )
override

Destructs a server object.

◆ Server()

Ocean::Network::Server::Server ( )
protected

Creates a new server object.

Member Function Documentation

◆ start()

virtual bool Ocean::Network::Server::start ( )
virtual

Starts the server.

Beware: If a specific listening port is expected the own port has to be set before

Returns
True, if succeeded

Reimplemented in Ocean::Network::UDPServer, Ocean::Network::TCPServer, and Ocean::Network::PackagedUDPServer.

◆ stop()

virtual bool Ocean::Network::Server::stop ( )
virtual

Stops the server.

Returns
True, if succeeded

Field Documentation

◆ buffer_

Buffer Ocean::Network::Server::buffer_
protected

The socket buffer of this server.

◆ schedulerIsActive_

bool Ocean::Network::Server::schedulerIsActive_ = false
protected

True, if the server scheduler is active.


The documentation for this class was generated from the following file: