-
September 2nd, 2010, 01:33 PM
#1
confused on first parameter of getaddrinfo()
I have a error on this line:
getaddrinfo(argv[1], DEFAULT_PORT, &hints, &servinfo)
DEFAULT_PORT is a macro I made to the port number.
the next 2 paramters are from:
struct addrinfo hints, *servinfo;
ZeroMemory(&hints, sizeof(hints));
hints.ai_family = AF_INET;
hints.ai_socktype = SOCK_STREAM;
hints.ai_protocol = IPPROTO_TCP;
There error is with: argv[1]
It is a undeclared identifier and I can't debug with this error.
I followed a tutorial to write all my code and it told me to write argv[1]...
but I thought I was suppposed to write the IP there, Should I write the IP there instead?
I dont really know what argv[1] means.
This if for a Client App.
-
September 2nd, 2010, 01:41 PM
#2
Re: confused on first parameter of getaddrinfo()
According to MSDN
pNodeName [in, optional]
A pointer to a NULL-terminated ANSI string that contains a ho st (node) name or a numeric host address string. For the Internet protocol, the numeric host address string is a dotted-decimal IPv4 address or an IPv6 hex address.
So if it was set into your argv[1] then it should work, otherwise you'd be probably much easier pass the ip-address directly!?
Victor Nijegorodov
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|