안녕하세요..
유동 ip 사용할때 자신의 ip를 얻어오는 프로그램을 짜고 있는데요..
여기 게시판에서 찾은 프로그램(밑에 있는)을 돌리면
계속 127.0.0.1만 나오네요..
gethostbyname함수는 /etc/host 파일을 참고해서 주소정보를
받아온다는데 그 파일을 찾아가면 127.0.0.1 밖에 없더군요...
실제 할당받은 ip주소를 얻을수 있는 방법은 없나요?
#include <netinet/in.h>
#include <sys/utsname.h>
#include <netdb.h>
/*
* Description : Current localhost IP
* Argument : addrtype - type of address (INET4 or INET6)