求简略的稳定的获取本机ip的方法

求简单的稳定的获取本机ip的方法
附代码最好,谢谢
------解决思路----------------------
/****************************************************** 
主题:提取机器名或IP地址 
入参:name_ip   1为机器名、非1IP 
出参:机器名或IP 
调用: 
        function   int   WSAStartup(   uint   UIVersionRequested,   ref   s_WSAData   lpWSAData   )   library   "wsock32.dll " 
        function   int   WSACleanup()   library   "wsock32.dll " 
        function   int   WSAGetLastError   (   )   library   "wsock32.dll " 
        function   int   gethostname   (   ref   string   name,   int   namelen   )   library   "wsock32.dll " 
        function   string   GetHost(string   lpszhost,   ref   blob   lpszaddress   )   library   "pbws32.dll "   
*******************************************************/ 

s_wsadata l_WSAData 
string ls_HostName   =   space(128) 
string ls_IpAddress 
int li_version   =   257 
blob{4}   lb_hostaddress   
/*   Then,   create   a   session,   based   on   the   winsock   version.   This   version   number   consists   of   two   part,   a   major   and   minor   release   number,   both   represented   in   a   byte.   So,   version   1.1   gives   us   an   integer   version   of   257   (   256   +   1   )   */ 
IF   wsastartup   (   li_version,   l_WSAData   )   =   0   THEN 
/*   the   wsadata   structure   contains   several   information.   The   description   element   tells   us   the   winsock   version   */ 
//messagebox( "Winsock   Version ",   l_WSAData.description   ) 
/*   Now,   let 's   find   out   what   the   hostname   is   of   the   current   machine   we 're   working   on   */