2.6.7: Does socket.gethostbyaddr truncate?

Peter J. Holzer hjp-python at hjp.at
Sat Feb 3 06:11:51 EST 2018


On 2018-01-30 08:56:16 -0800, Dan Stromberg wrote:
> dig -x should return a single PTR in all cases, shouldn't it?

No. dig -x should return *all* PTR records. There is usually at most one
of them, but there may be several. (46 seems a bit much, but there
really isn't any limit).

> What IP are you using?

Yup. I want to see an address with 46 PTR records, too ;-).

> On Tue, Jan 30, 2018 at 4:05 AM, Antoon Pardon <antoon.pardon at vub.be> wrote:
> > I am using python 2.6.7 to do a little network programming, but it seems I don't
> > get all the results.
> >
> > When I call socket.gethostbyaddr(IP) entry [1] of the result is a list of 34 addresses.

gethostbyaddr just calls the underlying C library function. It is
possibly that this has a limit (either on the number of names or more
likely on the packet size).

        hp

-- 
   _  | Peter J. Holzer    | we build much bigger, better disasters now
|_|_) |                    | because we have much more sophisticated
| |   | hjp at hjp.at         | management tools.
__/   | http://www.hjp.at/ | -- Ross Anderson <https://www.edge.org/>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20180203/152076c4/attachment.sig>


More information about the Python-list mailing list