TransportSend() 공개 메소드

public TransportSend ( byte bytes, int numBytes, int channelId, byte &error ) : bool
bytes byte
numBytes int
channelId int
error byte
리턴 bool
예제 #1
0
 public bool SendToTransport(NetworkConnection conn, int channelId)
 {
     byte num;
     bool flag = true;
     if (!conn.TransportSend(this.m_Buffer, (ushort) this.m_Position, channelId, out num) && (!this.m_IsReliable || (num != 4)))
     {
         if (LogFilter.logError)
         {
             Debug.LogError(string.Concat(new object[] { "Failed to send internal buffer channel:", channelId, " bytesToSend:", this.m_Position }));
         }
         flag = false;
     }
     if (num != 0)
     {
         if (this.m_IsReliable && (num == 4))
         {
             NetworkDetailStats.IncrementStat(NetworkDetailStats.NetworkDirection.Outgoing, 30, "msg", 1);
             return false;
         }
         if (LogFilter.logError)
         {
             Debug.LogError(string.Concat(new object[] { "Send Error: ", (NetworkError) num, " channel:", channelId, " bytesToSend:", this.m_Position }));
         }
         flag = false;
     }
     this.m_Position = 0;
     return flag;
 }
예제 #2
0
        public bool SendToTransport(NetworkConnection conn, int channelId)
        {
            bool result = true;

            if (!conn.TransportSend(m_Buffer, (ushort)m_Position, channelId, out byte error) && (!m_IsReliable || error != 4))
            {
                if (LogFilter.logError)
                {
                    Debug.LogError("Failed to send internal buffer channel:" + channelId + " bytesToSend:" + m_Position);
                }
                result = false;
            }
            if (error != 0)
            {
                if (m_IsReliable && error == 4)
                {
                    return(false);
                }
                if (LogFilter.logError)
                {
                    Debug.LogError("Send Error: " + error + " channel:" + channelId + " bytesToSend:" + m_Position);
                }
                result = false;
            }
            m_Position = 0;
            return(result);
        }
예제 #3
0
        public bool SendToTransport(NetworkConnection conn, int channelId)
        {
            byte num;
            bool flag = true;

            if (!conn.TransportSend(this.m_Buffer, (ushort)this.m_Position, channelId, out num) && (!this.m_IsReliable || (num != 4)))
            {
                if (LogFilter.logError)
                {
                    Debug.LogError(string.Concat(new object[] { "Failed to send internal buffer channel:", channelId, " bytesToSend:", this.m_Position }));
                }
                flag = false;
            }
            if (num != 0)
            {
                if (this.m_IsReliable && (num == 4))
                {
                    NetworkDetailStats.IncrementStat(NetworkDetailStats.NetworkDirection.Outgoing, 30, "msg", 1);
                    return(false);
                }
                if (LogFilter.logError)
                {
                    Debug.LogError(string.Concat(new object[] { "Send Error: ", (NetworkError)num, " channel:", channelId, " bytesToSend:", this.m_Position }));
                }
                flag = false;
            }
            this.m_Position = 0;
            return(flag);
        }
예제 #4
0
        public bool SendToTransport(NetworkConnection conn, int channelId)
        {
            bool flag = true;
            byte error;

            if (!conn.TransportSend(this.m_Buffer, (int)(ushort)this.m_Position, channelId, out error) && (!this.m_IsReliable || (int)error != 4))
            {
                if (LogFilter.logError)
                {
                    Debug.LogError((object)("Failed to send internal buffer channel:" + (object)channelId + " bytesToSend:" + (object)this.m_Position));
                }
                flag = false;
            }
            if ((int)error != 0)
            {
                if (this.m_IsReliable && (int)error == 4)
                {
                    NetworkDetailStats.IncrementStat(NetworkDetailStats.NetworkDirection.Outgoing, (short)30, "msg", 1);
                    return(false);
                }
                if (LogFilter.logError)
                {
                    Debug.LogError((object)("Send Error: " + (object)error + " channel:" + (object)channelId + " bytesToSend:" + (object)this.m_Position));
                }
                flag = false;
            }
            this.m_Position = 0;
            return(flag);
        }
예제 #5
0
        public bool SendToTransport(NetworkConnection conn, int channelId)
        {
            bool result = true;
            byte b;

            if (!conn.TransportSend(this.m_Buffer, (int)((ushort)this.m_Position), channelId, out b))
            {
                if (!this.m_IsReliable || b != 4)
                {
                    if (LogFilter.logError)
                    {
                        Debug.LogError(string.Concat(new object[]
                        {
                            "Failed to send internal buffer channel:",
                            channelId,
                            " bytesToSend:",
                            this.m_Position
                        }));
                    }
                    result = false;
                }
            }
            if (b != 0)
            {
                if (this.m_IsReliable && b == 4)
                {
                    return(false);
                }
                if (LogFilter.logError)
                {
                    Debug.LogError(string.Concat(new object[]
                    {
                        "Send Error: ",
                        b,
                        " channel:",
                        channelId,
                        " bytesToSend:",
                        this.m_Position
                    }));
                }
                result = false;
            }
            this.m_Position = 0;
            return(result);
        }
        public bool SendToTransport(NetworkConnection conn, int channelId)
        {
            byte error;

            bool result = true;

            if (!conn.TransportSend(m_Buffer, (ushort)m_Position, channelId, out error))
            {
                if (m_IsReliable && error == (int)NetworkError.NoResources)
                {
                    // handled below
                }
                else
                {
                    if (LogFilter.logError)
                    {
                        Debug.LogError("Failed to send internal buffer channel:" + channelId + " bytesToSend:" + m_Position);
                    }
                    result = false;
                }
            }
            if (error != 0)
            {
                if (m_IsReliable && error == (int)NetworkError.NoResources)
                {
                    // this packet will be buffered by the containing ChannelBuffer, so this is not an error

#if UNITY_EDITOR
                    UnityEditor.NetworkDetailStats.IncrementStat(
                        UnityEditor.NetworkDetailStats.NetworkDirection.Outgoing,
                        MsgType.HLAPIResend, "msg", 1);
#endif
                    return(false);
                }

                if (LogFilter.logError)
                {
                    Debug.LogError("Send Error: " + (NetworkError)error + " channel:" + channelId + " bytesToSend:" + m_Position);
                }
                result = false;
            }
            m_Position = 0;
            return(result);
        }
예제 #7
0
        public bool SendToTransport(NetworkConnection conn, int channelId)
        {
            byte error;

            bool result = true;

            if (!conn.TransportSend(m_Buffer, (ushort)m_Position, channelId, out error))
            {
                if (m_IsReliable && error == (int)NetworkError.NoResources)
                {
                    // handled below
                }
                else
                {
                    if (LogFilter.logError)
                    {
                        Debug.LogError("Failed to send internal buffer channel:" + channelId + " bytesToSend:" + m_Position);
                    }
                    result = false;
                }
            }
            if (error != 0)
            {
                if (m_IsReliable && error == (int)NetworkError.NoResources)
                {
                    // this packet will be buffered by the containing ChannelBuffer, so this is not an error
                    return(false);
                }

                if (LogFilter.logError)
                {
                    Debug.LogError("Send Error: " + (NetworkError)error + " channel:" + channelId + " bytesToSend:" + m_Position);
                }
                result = false;
            }
            m_Position = 0;
            return(result);
        }
예제 #8
0
 public bool SendToTransport(NetworkConnection conn, int channelId)
 {
   bool flag = true;
   byte error;
   if (!conn.TransportSend(this.m_Buffer, (int) (ushort) this.m_Position, channelId, out error) && (!this.m_IsReliable || (int) error != 4))
   {
     if (LogFilter.logError)
       Debug.LogError((object) ("Failed to send internal buffer channel:" + (object) channelId + " bytesToSend:" + (object) this.m_Position));
     flag = false;
   }
   if ((int) error != 0)
   {
     if (this.m_IsReliable && (int) error == 4)
     {
       NetworkDetailStats.IncrementStat(NetworkDetailStats.NetworkDirection.Outgoing, (short) 30, "msg", 1);
       return false;
     }
     if (LogFilter.logError)
       Debug.LogError((object) ("Send Error: " + (object) error + " channel:" + (object) channelId + " bytesToSend:" + (object) this.m_Position));
     flag = false;
   }
   this.m_Position = 0;
   return flag;
 }