Re: getaddrinfo() returns WSAHOST_NOT_FOUND
From: Frederiek (fd_news_at_hotmail.com)
Date: 12/20/04
- Next message: Tom Widmer: "Re: BUG REPORT: internal compiler error on VC8.0 beta"
- Previous message: Vittorio Cellucci: "Debug Code executes Faster than Release under VC 7.1 when compile a .ASM file"
- In reply to: Arkady Frenkel: "Re: getaddrinfo() returns WSAHOST_NOT_FOUND"
- Next in thread: Joseph Partridge: "Re: getaddrinfo() returns WSAHOST_NOT_FOUND"
- Reply: Joseph Partridge: "Re: getaddrinfo() returns WSAHOST_NOT_FOUND"
- Messages sorted by: [ date ] [ thread ]
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
> >
- Next message: Tom Widmer: "Re: BUG REPORT: internal compiler error on VC8.0 beta"
- Previous message: Vittorio Cellucci: "Debug Code executes Faster than Release under VC 7.1 when compile a .ASM file"
- In reply to: Arkady Frenkel: "Re: getaddrinfo() returns WSAHOST_NOT_FOUND"
- Next in thread: Joseph Partridge: "Re: getaddrinfo() returns WSAHOST_NOT_FOUND"
- Reply: Joseph Partridge: "Re: getaddrinfo() returns WSAHOST_NOT_FOUND"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|