![]() |
Plasma Engine
2.0
|
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 = plDelegate<void(plFileserveClientContext&, plRemoteMessage&, plRemoteInterface&, plDelegate<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 (plUInt16 uiPort) |
Overrides the current port setting. May only be called when the server is currently not running. | |
plUInt16 | 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 (plUInt32 uiSystemID, ClientMessageHandler handler) |
Static Public Member Functions | |
static plResult | SendConnectionInfo (const char *szClientAddress, plUInt16 uiMyPort, const plArrayPtr< plStringBuilder > &myIPs, plTime timeout=plTime::MakeFromSeconds(10)) |
Public Attributes | |
plEvent< const plFileserverEvent & > | m_Events |
The server broadcasts events about its activity. | |
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 plFileSystem) the server needs to know what local path to map them to (it uses the configuration on plFileSystem). 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"
|
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.