Rework the server connection to be more structured
This commit is contained in:
1 parent
7b58ca0338
commit
64dbd02874
10 files changed
+139
-141
No files matched your search
@@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Net;
|
||||
|
||||
namespace Mistox.Server {
|
||||
|
||||
public class MistoxServer {
|
||||
public string ServerName { get; set; } = "";
|
||||
public IPAddress BindAddress { get; set; } = IPAddress.Any;
|
||||
public int Port { get; set; } = 9126;
|
||||
public int MaxClients { get; set; } = 10;
|
||||
public bool Alive { get; set; } = true;
|
||||
public ServerListener serverListener;
|
||||
public ConcurrentDictionary<string, TcpClientConnection> Connections { get; set; }
|
||||
|
||||
public EventHandler onUserConnected;
|
||||
public EventHandler onReceived;
|
||||
public EventHandler onUserDisconnected;
|
||||
}
|
||||
|
||||
public class TcpClientConnection {
|
||||
public string UserName { get; set; } = "";
|
||||
public bool IsAuthenticated { get; set; } = false;
|
||||
public DateTime LastHeartbeat { get; set; } = DateTime.UtcNow;
|
||||
public bool Connected { get; set; } = true;
|
||||
public IPAddress RemoteAddress { get; set; }
|
||||
public TCPConnection Connection { get; set; }
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user