#ifndef NETWORK_API_NETWORK_SERVER_H #define NETWORK_API_NETWORK_SERVER_H ////////////////////////////////////// // Created by Pontus Fransson 2013 // // Modified by Dennis Andersen 2014 // ////////////////////////////////////// #include "NetworkAPI_Preprocessor.h" #include "NetworkClient.h" #include "NetworkSession.h" #include namespace Oyster { namespace Network { extern "C" { class NET_API_EXPORT NetworkServer { public: enum ServerReturnCode { ServerReturnCode_Error, ServerReturnCode_Sucess }; public: NetworkServer(); NetworkServer(const NetworkServer&); const NetworkServer& operator=(const NetworkServer&); virtual ~NetworkServer(); /** Creates a server that clients can connect to * @param port The port the server will be listening for clients. * @param mainSession The main session the server will send connected clients to. * @return The server returncode */ ServerReturnCode Init(const int& port, NetworkSession const* mainSession); /** Starts the server allowing clients to connect * @return The server returncode */ ServerReturnCode Start(); /** * */ void Stop(); /** Shutdown the server and return all resources. */ void Shutdown(); /** Parses asynchronous connected clients. */ void ProcessConnectedClients(); /** Set the main session connected clients will enter when connected to server. * @param mainSession The session to connect as main server session. */ void SetSession(NetworkSession const* mainSession); /** Get the main session connected with the server * @return Returns the main session */ NetworkSession const* GetMainSession(); /** Sets the main session to NULL and returns it * @return Returns the main session */ NetworkSession const* ReleaseMainSessionSession(); /** * */ bool IsStarted() const; private: struct PrivateData; PrivateData* privateData; }; } } } #endif