int SendPacket(UdpCProtocol type, NetworkConnection id)
        {
            Connection connection;

            if ((connection = GetConnection(id)) == Connection.Null)
            {
                return(0);
            }

            return(SendPacket(type, connection));
        }
Example #2
0
        int SendPacket(UdpCProtocol type, network_address address)
        {
            var header = new UdpCHeader
            {
                Type = (byte)type
            };

            unsafe
            {
                return(NativeSend(ref header, null, 0, address));
            }
        }
Example #3
0
        int SendPacket(UdpCProtocol type, NetworkConnection id)
        {
            Connection connection;

            if ((connection = GetConnection(id)) == Connection.Null)
            {
                return(0);
            }

            DebugLog("SendPacket " + " ID=" + id.m_NetworkId + " Attempts=" + connection.Attempts + " LastAttempt=" + connection.LastAttempt);

            return(SendPacket(type, connection.Address));
        }
        int SendPacket(UdpCProtocol type, Connection connection)
        {
            var header = new UdpCHeader
            {
                Type         = (byte)type,
                SessionToken = connection.SendToken
            };

            unsafe
            {
                if (connection.DidReceiveData == 0)
                {
                    header.Flags = 1;
                    return(NativeSend(m_NetworkInterface, ref header, &connection.ReceiveToken, 2, null, 0, connection.Address));
                }
                return(NativeSend(m_NetworkInterface, ref header, null, 0, null, 0, connection.Address));
            }
        }