On Tue, Feb 2, 2010 at 5:24 PM, Bob Halley <[email protected]> wrote:
>
> On 2 Feb 2010, at 15:34, Luca Dionisi wrote:
>
>> In my simple app, I listen for a message on port 53 UDP.
>> Then I use dns.message.from_wire to obtain a Message object.
>> Now I want to reply back, so I use
>>   resp = dns.message.make_response
>> to get a skeleton for the answer.
>> Of course I know the IP that I want to reply back as an answer to the client.
>
>> Now, how do I add the IP address to the object?
>
> # Something like this
>
> qname = request.question[0].name
> rrset = dns.rrset.from_text(qname, 300,
>                dns.rdataclass.IN, dns.rdatatype.A,
>                '10.0.0.1')
> resp.answer.append(rrset)
>
>> Then, I think that I will do a resp.to_wire() to get the data to pass
>> back via socket.
>
> Yes.
>
> /Bob
>
>

It works.
And what about an answer to tell the client that the hostname is not existant?
_______________________________________________
dnspython-users mailing list
[email protected]
http://howl.play-bow.org/mailman/listinfo.cgi/dnspython-users

Reply via email to