Hi Ikegami

Thanks for reply.

pack('n',1) encodes the data as '0001'. But how can can i convert $QTYPE=23 to the hexa value of 2 octets which is '0023'. If i use pack('n', 23) then it enocdes it as '0017'. Plz suggest.

The second thing is that I am extracting the domain name from the Req URI of a SIP message received. By using which i am sending the DNS request.Suppose sometimes i am getting 'www.google.com' ,

sometimes i am getting 'www.yahoo.com' or anything else in the SIP message which is not fixed. So is there any function in perl which directly convert the domain name into the required hexa format so that wireshark will decode it properly without doing any manual countings of characters in each segment of the domain name.

Actually what i am wanting is as follows. I am getting the domain as 'www.google.com'. After putting it in the argument in any perl function it converts it into the '0377777706676F6F676C6503636F6D00' without doing any further things. So that i can use that variable along with other variables while sending the DNS request.Plz suggest

Regd's
Sanjay

In reply to Re^2: How to create a DNS message in perl? by sanjay nayak
in thread How to create a DNS message in perl? by sanjay nayak

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.