티스토리 뷰
1 2 3 4 5 | char hostname[255]; PHOSTENT hostinfo = NULL; if (gethostname(hostname, sizeof(hostname)) == 0) if ((hostinfo = gethostbyname(hostname)) != NULL) printf("server address -> %s\n", inet_ntoa(*(struct in_addr*)*hostinfo->h_addr_list)); | cs |
'Network Programming > C & C++' 카테고리의 다른 글
select기반 Server (0) | 2017.10.23 |
---|---|
socket_client (0) | 2015.06.19 |
socket_server (0) | 2015.06.18 |
댓글