void RecvSynchronizeGameTime(IIPSocket conn, BitStream r) { // Just reply immediately with the current game time using (var pw = ServerPacket.SetGameTime(DateTime.Now)) { conn.Send(pw, ServerMessageType.GUI); } }
/// <summary> /// When overridden in the derived class, allows for handling when the status of an <see cref="IIPSocket"/> changes. /// </summary> /// <param name="sender">The <see cref="IIPSocket"/> who's status has changed.</param> /// <param name="status">The new status.</param> /// <param name="reason">The reason for the status change.</param> protected override void OnReceiveStatusChanged(IIPSocket sender, NetConnectionStatus status, string reason) { base.OnReceiveStatusChanged(sender, status, reason); switch (status) { case NetConnectionStatus.Disconnected: // If there was an account on the socket, destroy it var acc = World.GetUserAccount(sender, false); if (acc != null) { acc.Dispose(); } break; case NetConnectionStatus.Connected: // Send the server time to the client using (var pw = ServerPacket.SetGameTime(DateTime.Now)) { sender.Send(pw, ServerMessageType.GUI); } break; } }