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ϸ\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
**********************************************************
Brad Coish Junior Programmer
Dymaxion Research Ltd., Bus: (902)422-1973 Ext.106
5515 Cogswell St., Fax: (902)421-1267
Halifax, Nova Scotia, Internet: BCoish / dymaxion.com
Canada B3J 1R2
In the beginning the Universe was created.
This has made a lot of people very angry and been widely
regarded as a bad move.
HHG 2:1