[Help] Problem with Ruby SOCKET API on OpenVMS

All:

Problem:
TCP/IP socket routine(s) not functioning properly on OpenVMS.

Specifics:
The Socket.gethostbyname routine does not return the proper
values. It’s supposed to return an array filled with the
canonical host name, sub-list of aliases, the connection family
and the address portion of the host sockaddr.

When the addrinfo length is displayed, the length of the address is
16 bytes when it should only be 4 and the pointer to the list of
network addresses (returned from the name server) is also incorrect.
Example:

  require 'socket'
  a = Socket.gethostbyname("216.87.136.211")
  p a

Output :
[“pragdave211.august.net”, [],
2,"\000\002\000\000ØW\210Ó\000\000\000\000\000\000\000"]

  Example of correct output from windows:
  ["pragdave211.august.net", [], 2, "\330W\210\323"]

If in make_hostent I changed:
for (ai = addr; ai; ai = ai->ai_next) {
rb_ary_push(ary, (*ipaddr)(ai->ai_addr, ai->ai_addrlen));
}
to:
for (ai = addr; ai; ai = ai->ai_next) {
rb_ary_push(ary, (*ipaddr)(h->h_addr, h->h_length));
}
Then it works

Is there something that I’m missing? Seems that the 'generic’
addrinfo class should have it’s fields set by the values stored in the
hostent variable rather than ignored.

Any help would be greatly appreciated.

Regards,
Brad

Hi,

···

In message “[Help] Problem with Ruby SOCKET API on OpenVMS” on 04/05/19, Brad BCoish@Dymaxion.com writes:

Problem:
TCP/IP socket routine(s) not functioning properly on OpenVMS.

It’s not OpenVMS specific. Socket.gethostbyname() gives you packed
struct sockaddr, not packed octet decimals.

						matz.