Changeset View
Changeset View
Standalone View
Standalone View
source/network/NetServer.h
Show First 20 Lines • Show All 98 Lines • ▼ Show 20 Lines | |||||
{ | { | ||||
NONCOPYABLE(CNetServer); | NONCOPYABLE(CNetServer); | ||||
public: | public: | ||||
/** | /** | ||||
* Construct a new network server. | * Construct a new network server. | ||||
* @param autostartPlayers if positive then StartGame will be called automatically | * @param autostartPlayers if positive then StartGame will be called automatically | ||||
* once this many players are connected (intended for the command-line testing mode). | * once this many players are connected (intended for the command-line testing mode). | ||||
*/ | */ | ||||
CNetServer(int autostartPlayers = -1); | CNetServer(const CStrW& serverName = L"", int autostartPlayers = -1); | ||||
~CNetServer(); | ~CNetServer(); | ||||
/** | /** | ||||
* Begin listening for network connections. | * Begin listening for network connections. | ||||
* This function is synchronous (it won't return until the connection is established). | * This function is synchronous (it won't return until the connection is established). | ||||
* @return true on success, false on error (e.g. port already in use) | * @return true on success, false on error (e.g. port already in use) | ||||
*/ | */ | ||||
▲ Show 20 Lines • Show All 57 Lines • ▼ Show 20 Lines | public: | ||||
* Send a message to all clients who match one of the given states. | * Send a message to all clients who match one of the given states. | ||||
*/ | */ | ||||
bool Broadcast(const CNetMessage* message, const std::vector<NetServerSessionState>& targetStates); | bool Broadcast(const CNetMessage* message, const std::vector<NetServerSessionState>& targetStates); | ||||
private: | private: | ||||
friend class CNetServer; | friend class CNetServer; | ||||
friend class CNetFileReceiveTask_ServerRejoin; | friend class CNetFileReceiveTask_ServerRejoin; | ||||
CNetServerWorker(int autostartPlayers); | CNetServerWorker(const CStrW& serverName, int autostartPlayers); | ||||
~CNetServerWorker(); | ~CNetServerWorker(); | ||||
/** | /** | ||||
* Begin listening for network connections. | * Begin listening for network connections. | ||||
* @return true on success, false on error (e.g. port already in use) | * @return true on success, false on error (e.g. port already in use) | ||||
*/ | */ | ||||
bool SetupConnection(const u16 port); | bool SetupConnection(const u16 port); | ||||
▲ Show 20 Lines • Show All 177 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator