Lara Framework

Starting LARA server

Below is the declaration of the method for starting lara server:




Parameters

-mainPort: The main port that is responsible for transferring API requests, custom packets and files.
-serverDataDirectory: The directory where server cloud data is stored. In this directory a subdirectory named 'users' will be created to store users' files. When this value is null or not valid a default directory named 'ServerData' will be created at the same directory where the assembly 'Lara.dll' is located. If creating this directory was not successful, for example, due to denied access rights, an exception will be thrown, and LARA server will not start!


Example of starting the server:




When LARA server starts successfuly the console window will look like this:




Notice: For clients to be able to connect to LARA server, the ports used for connection must be open in firewall settings.

An example for allowing the ports used in the code above on the Linux uncomplicated firewall (the default firewall configuration tool that comes with Linux system) would look like this:

ufw allow 22000/tcp
ufw allow 22000/udp


Establishing connection to LARA server

There are 2 ways for connecting LARA client to LARA server. The first method is in async-style and looks like this:




The second method utilizes the functional callback-style and looks like this:




It is also possible to add an autoconnection functionality through setting the value of the property 'AutoConnectionInterval_Sec'. After activating this functionality, the client will keep trying to connect to server, when connection to server gets interrupted. Setting the property to 0 will disable this functionality. The default value is 0.

An example of using this functionality looks like this:




Back to main
Go to authentication system