コード例 #1
0
ファイル: NetPing.cs プロジェクト: MicroWorldwide/MMOMahjong
        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);
        }
コード例 #2
0
        /// <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);
        }
コード例 #3
0
        /// <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);
        }
コード例 #4
0
ファイル: NetServer.cs プロジェクト: TerenceWallace/bloodbox
		/// <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;
		}