예제 #1
0
    public void SendMessage(Message message, IPEndPoint ipEndPoint, Connection connection)
    {
        // Send the data
        var messages = new List <Message>();

        messages.Add(message);
        var datagram = new Datagram(messages);

        connection.SendData(datagram.DatagramToByteArray(), ipEndPoint);
    }
예제 #2
0
    public void SendACK(Int32 ack, IPEndPoint ipEndPoint, Connection connection)
    {
        var data = BitConverter.GetBytes(ack);
        // No need to send the sequence with the ack
        var message  = new Message(MessageType.Ack, Stream.ReliableFast, GetMessageId(ipEndPoint), data, 0);
        var messages = new List <Message>();

        messages.Add(message);
        var datagram = new Datagram(messages);

        connection.SendData(datagram.DatagramToByteArray(), ipEndPoint);
    }