LitDev Extension API
LDServer
Server and Client communication between computers.
Separate programs are required for the server and client - this is for the server.
AutoMessages
Show TextWindow connection messages when in auto mode "True" (default) or "False".
Broadcast(message)
Send a message to all clients.
message The message may be any variable including an array.
returns A array of values "SUCCESS", "NOT_CONNECTED", "NO_CLIENT" or "FAILED" with the Client Name being the index.
ClientConnected
Event when a client connects.
ClientDisconnected
Event when a client disconnects.
ClientMessage
Event when a client sends a message to the server.
Close(clientName)
Disconnect and close (End) a client.
clientName The client name, usually Client1, Client2 etc.
A list of current clients can be obtained from the method GetClients or found from the ClientConnected event.
returns "SUCCESS", "NOT_CONNECTED", "NO_CLIENT" or "FAILED"
CloseDelay
A delay in ms (default 100) when disconnecting to allow a message to be sent before connection closed (Stop, Disconnect and Close).
This delay should also be set for clients in LDClient.CloseDelay.
Disconnect(clientName)
Disconnect a client.
clientName The client name, usually Client1, Client2 etc.
A list of current clients can be obtained from the method GetClients or found from the ClientConnected event.
returns "SUCCESS", "NOT_CONNECTED", "NO_CLIENT" or "FAILED"
GetClients()
Get a list of current connected clients.
returns An array of current client names or "" for none.
IP
The IP address of the server (it is defaulted to the current LAN IP).
If you want to use over the internet, then a web IP will be needed.
LastClient
The last client name.
LastClientConnected
The last client connected name.
LastClientDisconnected
The last client disconnected name.
LastClientMessage
The last client message.
Port
The windows port to use (default 100).
SendMessage(clientName,message)
Send a message to a client.
clientName The client name, usually Client1, Client2 etc.
A list of current clients can be obtained from the method GetClients or found from the ClientConnected event.
message The message may be any variable including an array.
returns "SUCCESS", "NOT_CONNECTED", "NO_CLIENT" or "FAILED"
Start(auto)
Start the server.
auto Enable auto message passing "True" or "False".
If this is used (recommended) then all client data is passed via server to all other clients,
and no processing of send and receive events is required.
The data is updated to arrays of data (indexed by client name) that is returned from the client Update methods.
The auto option should be the same for server and all clients.
returns The current connection parameter ip:port (e.g. "192.168.1.60:100"), or "FAILED".
This is the parameter to use to connect from the client.
Stop()
Stop the current server and close all clients.
returns "SUCCESS" or "FAILED"