이런 에러메시지가 나옵니다. 물론 리눅스에선 잘 컴파일 됩니다.
왜그런걸까요?
]# cc -o get_hostname get_hostname.c
License Error : Cannot connect to the license server (cs)..
for product(SPARCompiler C).
(License server may not have been started)
Cannot connect to license server (-15,12:146) Connection refused
cc: acomp failed for get_hostname.c
위에처럼 나오는데요. 왜그런지 알수가 없네요. 소스는 아래와
같습니다. gethostbyname()함수만 쓸려면 그러는거 같은데...
#include stdio.h
#include sys/types.h
#include netinet/in.h
#include netdb.h
int main(int argc, char **argv)
{
struct hostent *myhost;
struct in_addr myinaddr;
int i;
if(argc < 2){
printf("Using : %s host_name(Domain Name)", argv[0]);
exit(0);
}
myhost = gethostbyname(argv[1]);
if(myhost == 0){
printf("error at gethostbyname");
exit(0);
} printf("Official host name : %s", myhost->h_name);
i = 0;
while(myhost->h_aliases[i] != NULL){
printf("aliases name : %s", myhost->h_aliases[i]);
i++;
}
printf("host address type : %d", myhost->h_addrtype);
printf("length of host address : %d", myhost->h_length);
i = 0;
while(myhost->h_addr_list[i] != NULL){
myinaddr.s_addr = *((u_long *)(myhost->h_addr_list[i]));
printf("IP Address : %s", inet_ntoa(myinaddr));
i++;
}
exit(0);
}