Ocean
Server.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) Meta Platforms, Inc. and affiliates.
3  *
4  * This source code is licensed under the MIT license found in the
5  * LICENSE file in the root directory of this source tree.
6  */
7 
8 #ifndef FACEBOOK_NETWORK_SERVER_H
9 #define FACEBOOK_NETWORK_SERVER_H
10 
11 #include "ocean/network/Network.h"
12 #include "ocean/network/Port.h"
13 #include "ocean/network/Socket.h"
14 
15 namespace Ocean
16 {
17 
18 namespace Network
19 {
20 
21 /**
22  * This class is the base class for all server.
23  * @ingroup network
24  */
25 class OCEAN_NETWORK_EXPORT Server : virtual public Socket
26 {
27  public:
28 
29  /**
30  * Destructs a server object.
31  */
32  ~Server() override;
33 
34  /**
35  * Starts the server.
36  * Beware: If a specific listening port is expected the own port has to be set before
37  * @return True, if succeeded
38  */
39  virtual bool start();
40 
41  /**
42  * Stops the server.
43  * @return True, if succeeded
44  */
45  virtual bool stop();
46 
47  protected:
48 
49  /**
50  * Creates a new server object.
51  */
52  Server();
53 
54  protected:
55 
56  /// The socket buffer of this server.
58 
59  /// True, if the server scheduler is active.
60  bool schedulerIsActive_ = false;
61 };
62 
63 }
64 
65 }
66 
67 #endif // FACEBOOK_NETWORK_SERVER_H
This class is the base class for all server.
Definition: Server.h:26
~Server() override
Destructs a server object.
virtual bool start()
Starts the server.
Buffer buffer_
The socket buffer of this server.
Definition: Server.h:57
Server()
Creates a new server object.
virtual bool stop()
Stops the server.
This class is the base class for all sockets.
Definition: Socket.h:31
std::vector< uint8_t > Buffer
Definition of a vector holding 8 bit values.
Definition: Socket.h:76
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15