Hi Guys,
Get IP address of the device, when they connected to network.
private void GetMyIP()
{
IPHostEntry hostentry = Dns.GetHostEntry(Dns.GetHostName());
if (hostentry != null)
{
IPAddress[] collectionOfIPs = hostentry.AddressList;
MessageBox.Show(collectionOfIPs[0].ToString());
}
}
Thank you
Subscribe to:
Post Comments (Atom)
3 comments:
hi!! what references do you use for IPHostEntry , dns and IPAdress.
this is one of the errors.
"The type or namespace name 'IPHostEntry' could not be found (are you missing a using directive or an assembly reference?)"
thank you
you have to add the namespace System.Net to your "using" list.
thanks my man, your article realy helpfull for me
Post a Comment