protected void _init(Communicate c) { Session session = Session.getInstance(); ClientsInfo clients = ClientsInfo.getInstance(); if (session.Status(c.sessID) == Session.SESSION_NONE) { c.sessID = session.Start(c.sessID); clients.AddClient(c.sessID, _client); } else { c.sessID = session.Start(c.sessID); } }
void OnAcceptCompleted(object sender, SocketAsyncEventArgs e) { if (e.SocketError == SocketError.Success) { Session session = _sessionFactory.Invoke(); session.Start(e.AcceptSocket); } else { Console.WriteLine($"OnAcceptCompleted Error: {e}"); } RegisterAccept(e); }
static void Main(string[] args) { Console.WriteLine("Loading Assets..."); LoadAccounts(); LoadMessages(); LoadAnnouncements(); LoadMessageBoards(); sessions = new List <Session>(); cloudData = new CloudData(); cloudData.Load(); Console.WriteLine("Starting Server..."); listener = new TcpListener(IPAddress.Any, 25565); listener.Start(); while (true) { if (listener.Pending()) { Session.Start(listener.AcceptTcpClient(), ref sessions); } } }