obsolete attribute means this method is old, and another one is used (GetHostEntry in your case)!
We use this attribute to tell developers who use our libraries that this method no longer use and use an alternative (the new one) + telling the compiler to raise warning or error if it used!
Understood?
Ramy Mahrous
Postaholic
2,196 posts since Aug 2006
Reputation Points: 480
Solved Threads: 276
You didn't said I want just IPv4
To get it
dim host as IPHostEntry
dim hostname as string
hostname = "lmlmlaa";
host = Dns.GetHostEntry(hostname)
For Each ip As IPAddress In host.AddressList
if ip.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork
MessageBox.Show(ip.ToString())
Next
I don't know VB.NET, I tried to convert it to VB.NET as much as I can.
Ramy Mahrous
Postaholic
2,196 posts since Aug 2006
Reputation Points: 480
Solved Threads: 276
Please concentrate in my answer and try this code, don't get me another pieces of code which I didn't write and say it doesn't work!!!!!!!!!
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
dim host as IPHostEntry
dim hostname as string
hostname = My.Computer.Name
host = Dns.GetHostEntry(hostname)
For Each ip As IPAddress In host.AddressList
if ip.AddressFamily = System.Net.Sockets.AddressFamily.InterNetwork
ComboBox1.Items.Add(ip)
end if
Next
Ramy Mahrous
Postaholic
2,196 posts since Aug 2006
Reputation Points: 480
Solved Threads: 276
It doesn't return 3 items, seem you don't care! I tried my code before posting it works fine. I won't go on in this thread.
Excuse me!
Ramy Mahrous
Postaholic
2,196 posts since Aug 2006
Reputation Points: 480
Solved Threads: 276
Comatose
Taboo Programmer
2,910 posts since Dec 2004
Reputation Points: 361
Solved Threads: 215
Hmmn. I only get one entry... but I don't have IPV6 enabled either.
Comatose
Taboo Programmer
2,910 posts since Dec 2004
Reputation Points: 361
Solved Threads: 215