Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact

Ticket #1133 (closed enhancement: wontfix)

Opened 16 years ago

Last modified 16 years ago

change NetHost implementation to getnameinfo?

Reported by: tezem Assigned to: Nietsnie
Priority: trivial Milestone: 1.0
Component: Tango Version: 0.99.6 Jeff
Keywords: Cc:

Description

I am not sure if it is good to change the current implementation but I create this ticket for discussion purposes. I needed a program where I could check if there exists a DNS name for a given IP and gethostbyaddr was too slow for this task. (too big timeout?) This led me to getnameinfo which was much faster. Now the question is if the current implementation in NetHost? should be changed to be using getnameinfo instead of gethostbyaddr? Here is a small stub for how to use getnameinfo:

extern(C)
        int getnameinfo(sockaddr* sa, int salen,
                       char* host, size_t hostlen,
                       char* serv, size_t servlen, int flags);

struct sockaddr_in
{
        ushort sinfamily = AddressFamily.INET;
        ushort sin_port;
        uint sin_addr;
        char[8] sin_zero = [0];
}

                        sockaddr_in sa;
                        char[1025] hbuf;
                        bool dn = false;
                        sa.sin_addr = htonl(addr.addr);

                        if (!getnameinfo(cast(sockaddr*)&sa, sa.sizeof, &hbuf[0], hbuf.sizeof, null, 0, 8))
                                dn = true;

Change History

06/07/08 02:09:34 changed by kris

  • status changed from new to assigned.
  • milestone changed from 0.99.7 to 1.0.

06/10/08 15:51:20 changed by kris

  • owner changed from kris to Nietsnie.
  • status changed from assigned to new.

comments, Jeff?

06/11/08 16:56:56 changed by Nietsnie

I suggested this in the past as well with ticket #563.

However, we ran into some issues with it properly being supported in windows, and having to make our own .lib files for dmd. This became an issue, as tango doesn't have ownership over these files. I think now, with the tango.sys.SharedLib? we might be able to implement something without this limitation.

06/11/08 20:40:59 changed by kris

  • status changed from new to closed.
  • resolution set to wontfix.

Right... I recall that. Thanks for the heads' up, tezem ... we'll shelve this for now though