Updated
This commit is contained in:
@@ -35,26 +35,21 @@ namespace EonaCat.Connections.Server.Example
|
||||
var config = new Configuration
|
||||
{
|
||||
Protocol = ProtocolType.TCP,
|
||||
Port = 8080,
|
||||
UseSsl = true,
|
||||
UseAesEncryption = true,
|
||||
Port = 1111,
|
||||
UseSsl = false,
|
||||
UseAesEncryption = false,
|
||||
MaxConnections = 100000,
|
||||
ServerCertificate = new System.Security.Cryptography.X509Certificates.X509Certificate2("server.pfx", "p@ss"),
|
||||
//ServerCertificate = new System.Security.Cryptography.X509Certificates.X509Certificate2("server.pfx", "p@ss"),
|
||||
};
|
||||
|
||||
_server = new NetworkServer(config);
|
||||
int totalClients = 0;
|
||||
|
||||
// Subscribe to events
|
||||
_server.OnConnected += (sender, e) =>
|
||||
{
|
||||
Console.WriteLine($"Client {e.ClientId} connected from {e.RemoteEndPoint}");
|
||||
Console.Title = $"Active Connections: {++totalClients}";
|
||||
};
|
||||
|
||||
_server.OnConnectedWithNickname += (sender, e) =>
|
||||
{
|
||||
Console.WriteLine($"Client {e.ClientId} connected with nickname: {e.Nickname}");
|
||||
};
|
||||
|
||||
_server.OnDataReceived += async (sender, e) =>
|
||||
{
|
||||
@@ -72,10 +67,7 @@ namespace EonaCat.Connections.Server.Example
|
||||
};
|
||||
|
||||
_server.OnDisconnected += (sender, e) =>
|
||||
{
|
||||
Console.WriteLine($"Client {e.ClientId} disconnected");
|
||||
Console.Title = $"Active Connections: {--totalClients}";
|
||||
};
|
||||
|
||||
await _server.StartAsync();
|
||||
}
|
||||
|
Reference in New Issue
Block a user