Skip to content

Commit 6354504

Browse files
committed
adding basic info
1 parent acebcde commit 6354504

File tree

1 file changed

+65
-0
lines changed

1 file changed

+65
-0
lines changed

docs/usage/DdsServer.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# DdsServer
2+
3+
DDS.Net.Server.**DdsServer** is the main entry-point of the library to execute the server for variables' exchange. Its constructor takes following parameters:
4+
5+
```csharp
6+
DdsServer(
7+
ServerConfiguration config,
8+
VariablesConfiguration variablesConfig)
9+
```
10+
11+
12+
13+
As a simple use-case, the server can be executed as:
14+
15+
```csharp
16+
using DDS.Net.Server.Entities;
17+
using DDS.Net.Server.Interfaces;
18+
using DDS.Net.Server.Interfaces.DefaultLogger;
19+
using DDS.Net.Server.PublicExtensions;
20+
using DDS.Net.Server.PublicHelpers;
21+
22+
namespace DDS.Net.Server.ConsoleApp
23+
{
24+
internal class Program
25+
{
26+
private static ConsoleLogger logger =
27+
new ConsoleLogger(LogLevel.Information);
28+
private static DdsServer server = null!;
29+
30+
static void Main(string[] args)
31+
{
32+
(bool isEnabled,
33+
ServerConfiguration? config) =
34+
ConfigurationProvider
35+
.GetServerConfiguration("config.ini", logger);
36+
37+
if (isEnabled && config != null)
38+
{
39+
server = new DdsServer(
40+
config,
41+
ConfigurationProvider
42+
.GetVariablesConfiguration(
43+
"vars-config.ini", logger));
44+
45+
server.Start();
46+
}
47+
else
48+
{
49+
server = null!;
50+
logger.Error("Failed to start the server.");
51+
}
52+
53+
ConsoleHelpers
54+
.WaitForKey("Press ESC to exit.", ConsoleKey.Escape);
55+
56+
server?.Stop();
57+
}
58+
}
59+
}
60+
```
61+
62+
63+
64+
65+

0 commit comments

Comments
 (0)