Beispiel #1
0
        protected async Task <T> SendAndWaitForResponse <T>(UdpTrackerRequestMessage request)
            where T : UdpTrackerResponseMessage, new()
        {
            await Send(request);

            return(await Receive <T>());
        }
Beispiel #2
0
        protected Task Send(UdpTrackerRequestMessage message)
        {
            var ms     = new MemoryStream();
            var writer = new BigEndianBinaryWriter(ms);

            message.WriteTo(writer);
            writer.Flush();

            return(client.SendAsync(ms.ToArray(), (int)ms.Length, trackerUri.Host, trackerUri.Port));
        }