| Alli3454 (2) | |||||
Here is error output:
| |||||
|
|
|||||
| vlad from moscow (3662) | |
|
You defined main two times #include <stdio.h> #include <stdlib.h> #include <stdint.h> #include <winsock2.h> int main(){ #include <stdio.h> #include <stdlib.h> #include <stdint.h> #include <winsock2.h> int main(){ | |
|
|
|
| coderguru (3) | |
|
Yes, there were two main's in your code. It should look more like this. #include <stdio.h> #include <stdlib.h> #include <stdint.h> #include <winsock2.h> int main() { typedef struct addrinfo * hints; typedef struct addrinfo * res; int status; WSADATA wsadata; int statuswsadata; if((statuswsadata=WSAStartup(MAKEWORD(2,2),&wsadata))!=0) { printf("WSAStartup failed: %d\n",statuswsadata); } hints->ai_family =AF_INET; status=getaddrinfo("173.194.70.105",0,0,&res); char host[512],port[128]; status=getnameinfo(res->ai_addr,res->ai_addrlen,host,512,0,0,0); printf("Host: %s",host); freeaddrinfo(res); } | |
|
Last edited on
|
|