Why is gethostbyname in TCPSocket?

Looking for dns support, I found the gethostbyname method as a class
method of TCPSocket in the socket library.

Seems like an odd place, considering that gethostbyname is hardly
specific to TCP protocol alone.

Any idea why it was put there?

Cheers,
Mike

Looking for dns support, I found the gethostbyname method as a class
method of TCPSocket in the socket library.

$ ruby -rsocket -e 'p TCPSocket.ancestors'
[TCPSocket, IPSocket, BasicSocket, IO, File::Constants, Enumerable, Object, Kernel]

Seems like an odd place, considering that gethostbyname is hardly
specific to TCP protocol alone.

Any idea why it was put there?

It wasn't.

$ ruby -rsocket -e 'p Socket.gethostbyname("localhost")'
["localhost", , 30, "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\001"]

ยทยทยท

On Dec 20, 2006, at 18:00, msoulier wrote:

--
Eric Hodel - drbrain@segment7.net - http://blog.segment7.net

I LIT YOUR GEM ON FIRE!

msoulier ha escrito:

Looking for dns support, I found the gethostbyname method as a class
method of TCPSocket in the socket library.

Seems like an odd place, considering that gethostbyname is hardly
specific to TCP protocol alone.

Any idea why it was put there?

It wasn't. It's part of Socket, which seems rather logical. TCPSocket
just inherits from Socket.