우선 답변에 감사합니다 ^^
답변해주신데로 코딩을 해보았는데 결과값은 127.0.0.1 로 나와서 질문드렸습니다
127.0.0.1 이 본인의 IP인지는 당연히 알겠는데 이것은 loopback 용으로
테스트시에 사용되는것이고 외부Client 와 접속시 알려주어야 할 제 IP 를 알고싶어서요
제가 임시로 작성한 코드는 아래와 같습니다. 보시고 미비한곳이 있으면 알여주세요
다시한번 감사드립니다.꾸벅~
int main(int argc,char** argv)
{
char localhost[LEN] = { 0, };
int result;
struct hostent* host;
int i;
if ( (result=gethostname(localhost,LEN)) == 0 )
{
printf("Local Hostname is %s\n",localhost);
}
else if ( result == -1 )
{
printf("gethostname() is error\n");
}
else
{
printf("Unknown error\n");
}
host = gethostbyname(localhost);
for ( i = 0; host->h_addr_list[i]; i++ )
{
puts(inet_ntoa(*(struct in_addr*)host->h_addr_list[i]));
}
return 0;
}