Exemplo n.º 1
0
        public async Task <IObservable <Message> > ResolveAsync(string protocol)
        {
            ushort requestId = CreateRequestId();

            Message message = new Message(requestId);

            message.Questions.Add(new Question(protocol));

            byte[] byteMessage = message.GetBytes();

            await client.SendAsync(byteMessage, byteMessage.Length, EndPoint);

            return(this.answers.Where(x => x.ID == requestId || x.ID == 0));
        }
Exemplo n.º 2
0
        public async Task <IObservable <Message> > ResolveAsync(string protocol)
        {
            ushort requestId = CreateRequestId();

            Message message = new Message(requestId);

            message.Questions.Add(new Question(protocol));

            byte[] byteMessage = message.GetBytes();

            await Task.Factory.FromAsync(
                (buffer, ep, callback, state) => client.BeginSendTo(buffer, 0, buffer.Length, ep, callback, state),
                client.EndSendTo,
                byteMessage,
                EndPoint,
                null);

            return(this.answers.Where(x => x.ID == requestId || x.ID == 0));
        }