How can I get the IP automatically?
-
I am trying to do a chat room. How can I get the IP on which PC my server program is running automatically? Which method should I use?
struct hostent* phostent; char name[128]; gethostname( name, 128 ); phostent = gethostbyname( name ); if( phostent ) { CString strIP = inet_ntoa( *(in_addr*)phostent->h_addr_list[0] ); }
Are you have gtalk ? please add me: xiangyangzhao@gmail.com
-
struct hostent* phostent; char name[128]; gethostname( name, 128 ); phostent = gethostbyname( name ); if( phostent ) { CString strIP = inet_ntoa( *(in_addr*)phostent->h_addr_list[0] ); }
Are you have gtalk ? please add me: xiangyangzhao@gmail.com
Thank you for you answer firstly.I will try it. Sorry that I don't use GTalk, but I use the GTalk ToolKit to joined you. You can send me a mail:caiminsheng@gmail.com or join my QQ:113931427 if you would like to.
modified on Monday, December 24, 2007 5:36:46 AM