[Help] Problem with Ruby SOCKET API on OpenVMS

B

Brad

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
 
Y

Yukihiro Matsumoto

Hi,

In message "[Help] Problem with Ruby SOCKET API on OpenVMS"

|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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top