public void Run() { Utils.Log.Info("Amaryllis LS", " Connections are being accepted"); FireObject += new HandleDisconnection(OnDisconnection); ExposeIO += new HandleIO(OnValidPacket); Socket.BeginAccept(new AsyncCallback(IAccept), null); }
public IServer(int ID, string IPAddressString, int Port, string MySQLHostAddress, int MySQLHostPort, string[] MySQLAuthenticationDetails) { ServerID = ID; PortNumber = Port; SetupManager(); Socket = new Sockets.Socket(Sockets.AddressFamily.InterNetwork, Sockets.SocketType.Stream, Sockets.ProtocolType.Tcp); Socket.Bind(new System.Net.IPEndPoint(System.Net.IPAddress.Parse(IPAddressString), PortNumber)); Socket.Listen(MaximumConnectionsQueue); Socket.SetSocketOption(Sockets.SocketOptionLevel.Socket, Sockets.SocketOptionName.KeepAlive, true); EnableIOCommunicationTunneling += new HandleIO(OnValidPacket); FireObject += new HandleDisconnection(OnDisconnection); StatisticsUpdateTimer = new System.Timers.Timer(1000 * 240) { AutoReset = true }; StatisticsUpdateTimer.Elapsed += UpdateStatistics; if (Database.Database.Init(MySQLHostAddress, MySQLHostPort, MySQLAuthenticationDetails)) { Utils.Log.Info("MySQL", "A connection to the database has been made"); } Utils.Log.Debug(ServerID.ToString(), "Amaryllis is running"); }