XII Release 0.1.0
Loading...
Searching...
No Matches
xiiFileserver Class Reference

A file server allows to serve files from a host PC to another process that is potentially on another device. More...

#include <Fileserver.h>

Public Types

using ClientMessageHandler = xiiDelegate<void(xiiFileserveClientContext&, xiiRemoteMessage&, xiiRemoteInterface&, xiiDelegate<void(const char*)>)>
 

Public Member Functions

void StartServer ()
 Starts listening for client connections. Uses the configured port.
 
void StopServer ()
 Disconnects all clients.
 
bool UpdateServer ()
 Has to be executed regularly to serve clients and keep the connection alive.
 
bool IsServerRunning () const
 Whether the server was started.
 
void SetPort (xiiUInt16 uiPort)
 Overrides the current port setting. May only be called when the server is currently not running.
 
xiiUInt16 GetPort () const
 Returns the currently set port. If the command line option "-fs_port X" was used, this will return that value, otherwise the default is.
 
void BroadcastReloadResourcesCommand ()
 Broadcasts to all clients that they should reload their resources.
 
void SetCustomMessageHandler (xiiUInt32 uiSystemID, ClientMessageHandler handler)
 

Static Public Member Functions

static xiiResult SendConnectionInfo (const char *szClientAddress, xiiUInt16 uiMyPort, const xiiArrayPtr< xiiStringBuilder > &myIPs, xiiTime timeout=xiiTime::MakeFromSeconds(10))
 

Public Attributes

xiiEvent< const xiiFileserverEvent & > m_Events
 The server broadcasts events about its activity.
 

Detailed Description

A file server allows to serve files from a host PC to another process that is potentially on another device.

This is mostly useful for mobile devices, that do not have access to the data on the development machine. Typically every change to a file would require packaging the app and deploying it to the device again. Fileserve allows to only deploy a very lean application and instead get all asset data directly from a host PC. This also allows to modify data on the PC and reload the data in the running application without delay.

A single file server can serve multiple clients. However, to mount "special directories" (see xiiFileSystem) the server needs to know what local path to map them to (it uses the configuration on xiiFileSystem). That means it cannot serve two clients that require different settings for the same special directory.

The port on which the server connects to clients can be configured through the command line option "-fs_port X"

Member Function Documentation

◆ GetPort()

xiiUInt16 xiiFileserver::GetPort ( ) const
inline

Returns the currently set port. If the command line option "-fs_port X" was used, this will return that value, otherwise the default is.


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