예제 #1
0
        public bool SendToTransport(QNetworkConnection conn, int channelId)
        {
            var result = true;

            if (!conn.TransportSend(m_Buffer, (ushort)m_Position, channelId, out var b))
            {
                if (!m_IsReliable || b != 4)
                {
                    Debug.LogError($"Failed to send internal buffer channel:{channelId} bytesToSend:{m_Position}");
                    result = false;
                }
            }
            if (b != 0)
            {
                if (m_IsReliable && b == 4)
                {
                    return(false);
                }
                Debug.LogError($"Send Error: {(NetworkError)b} channel:{channelId} bytesToSend:{m_Position}");
                result = false;
            }
            m_Position = 0;
            return(result);
        }