Using system. net;
/// <Summary>
/// Obtain the email address used.
/// </Summary>
Public Void Getuserinfo ()
{
String SIP = "" ;
// Method 1
String Machinename = System. environment. machinename;
// Method 2
String Strhostname = DNS. gethostname ();
IPaddress [] ADDR;
// Obtain IP method 1
// ADDR = DNS. gethostaddresses (strhostname );
// Method 2
ADDR = DNS. gethostaddresses ( " 127.0.0.1 " );
// Method 3
// ADDR = DNS. gethostaddresses ("localhost ");
// Method 4
// iphostentry ihip = DNS. gethostentry (strhostname);
// ADDR = ihip. addresslist;
//Obtain the IP method 5, which indicates the old warning.
ADDR=DNS. gethostbyname (DNS. gethostname (). Addresslist;
If (ADDR. Length <= 1 )
{
SIP = ADDR [ 0 ]. Tostring ();
}
Else
{
For ( Int Icount = 0 ; Icount < ADDR. length; icount ++ )
{
SIP + = " IP " + (Icount + 1 ). Tostring () + " : " + ADDR [icount]. tostring () + " " ;
}
}
}