Re: getaddrinfo() returns WSAHOST_NOT_FOUND

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Frederiek (fd_news_at_hotmail.com)
Date: 12/20/04


Date: 20 Dec 2004 05:48:13 -0800

I checked with netstat to see which ports were already in use. Port
1024 was the first of the unreserved ports that was not in use. So I
set the second parameter of getaddrinfo() to "1024". But the result is
still WSAHOST_NOT_FOUND.

For your information, I am not familiar with the Windows Sockets API.
The only thing I want, is to retrieve the IP address of the local
computer. And as I believe, this has to be done with getaddrinfo().

Actually I don't understand why I should supply an arbitrary port
number, if I only want to retrieve the IP address of the local
computer. As I understand, portnumbers are associated with services, or
vice versa. And those services are used to communicate with other hosts
on the network. I do not see the relation between providing a random
portnumber, and retrieving the local host IP address.

Arkady Frenkel wrote:
> Check with netstat local ports and take one
> Arkady
>
> "Frederiek" <fd_news@hotmail.com> wrote in message
> news:1103299490.276929.114280@z14g2000cwz.googlegroups.com...
> > Hi,
> >
> > I try to retrieve the IP address of a local host. In order to do
this,
> > first I use gethostname(). The resulting host name is used as the
first
> > parameter of getaddrinfo(). Despite the fact that I supply the
correct
> > host name, getaddrinfo() returns WSAHOST_NOT_FOUND.
> >
> > My first guess is that the error relates to the second parameter
for
> > getaddrinfo(), i.e. a pointer to a string containing a service name
or
> > port number. The thing is, I set this parameter to NULL, because I
> > don't have a clue about what that string should contain.
> > Is there anyone who can help me along?
> >
> > Thanks,
> >
> > Frederiek
> >



Relevant Pages

  • Re: Blocking Outlook External POP/SMTP
    ... computers to retrieve their personal email. ... I don't see much harm in allowing private e-mail as long as ... Deny access to ports 143, 220 and 993 if you want to block IMAP. ...
    (Security-Basics)
  • End of my tether trying to retrieve keys from multi-dimensional hash
    ... contains the keys ZA1, YB4, XMM so that I can loop through the array ... and retrieve Description, Ports or whatever using. ... foreach $sid (@SIDS) { ...
    (comp.lang.perl.misc)
  • WMI .NET Classes & ports
    ... i'm using a C# program to retrieve some info from my clients; ... throuble with xp sp2 firewall: i know that i need to set exception for port ... 135 and 1826, but if i would to use other ports to connect, how can i do? ...
    (microsoft.public.win32.programmer.wmi)
  • Re: mplayer on 6.2
    ... => Couldn't fetch it - please try to retrieve this ... i just don't have the patience for this ports thing anymore.... ... just made that directory and stuck the codecs there and stuff appears to ...
    (freebsd-questions)
  • Re: Limiting closed port RST response from XXX to 200...
    ... > On a server I'm benchmark testing, via local host, I'm getting Limiting closed ... > port RST response from ... to 200 packets/sec on the console when I'm running a ... Check that you don't run out of TCP ports. ...
    (freebsd-hackers)