31 lines
1.0 KiB
C#
31 lines
1.0 KiB
C#
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; }
|
|
}
|
|
|
|
}
|