internal void SendOptimizeInfo(float roundtrip) { NetMessage ping = new NetMessage(NetMessageType.PingPong, 3); ping.Write(false); // meaningless ping.Write(true); // means optimize info ping.Write7BitEncodedUInt((uint)(roundtrip * 1000.0f)); m_connection.SendMessage(ping, NetChannel.Unreliable); }
/// <summary> /// Sends a message to the server using a specified channel /// </summary> public bool SendMessage(NetMessage msg, NetChannel channel) { if (m_serverConnection == null || m_serverConnection.Status == NetConnectionStatus.Disconnected) { Log.Warning("SendMessage failed - Not connected!"); return(false); } m_serverConnection.SendMessage(msg, channel); return(true); }
/// <summary> /// Sends a message to a certain connection using the channel specified /// </summary> public bool SendMessage(NetMessage msg, NetConnection connection, NetChannel channel) { if (connection == null) { throw new ArgumentNullException("connection"); } if (connection.Status == NetConnectionStatus.Disconnected) { Log.Warning("SendMessage failed - Connection is Disconnected!"); return(false); } connection.SendMessage(msg, channel); return(true); }
/// <summary> /// Sends a message to a certain connection using the channel specified /// </summary> public bool SendMessage(NetMessage msg, NetConnection connection, NetChannel channel) { if (connection == null) throw new ArgumentNullException("connection"); if (connection.Status == NetConnectionStatus.Disconnected) { Log.Warning("SendMessage failed - Connection is Disconnected!"); return false; } connection.SendMessage(msg, channel); return true; }