منتدى فيجوال بيسك لكل العرب | منتدى المبرمجين العرب
لمعرفة جميع عناوين Ip في الشبكة المحلية - نسخة قابلة للطباعة

+- منتدى فيجوال بيسك لكل العرب | منتدى المبرمجين العرب (http://vb4arb.com/vb)
+-- قسم : الأقسام التعليمية - المنتدى القديم (http://vb4arb.com/vb/forumdisplay.php?fid=90)
+--- قسم : مكتبة أكواد المنتدى (http://vb4arb.com/vb/forumdisplay.php?fid=111)
+---- قسم : مكتبة أكواد .net (http://vb4arb.com/vb/forumdisplay.php?fid=117)
+---- الموضوع : لمعرفة جميع عناوين Ip في الشبكة المحلية (/showthread.php?tid=6204)



لمعرفة جميع عناوين Ip في الشبكة المحلية - RaggiTech - 17-10-12

كاتب الموضوع : AhmedEssawy


كود :
Public Shared Function GetAllIP(Optional ByVal args As String() = Nothing) As Integer
'args in the signature is optional, without it
'the function will simply get the hostname
'of the local machine then go from there
Dim strHostName As New String("")
If args.Length = 0 Then
' Getting Ip address of local machine...
' First get the host name of local machine.
strHostName = DNS.GetHostName()
Console.WriteLine("Local Machine's Host Name: " + strHostName)
Else
strHostName = args(0)
End If
' Then using host name, get the IP address list..
Dim ipEntry As IPHostEntry = DNS.GetHostByName(strHostName)
Dim addr As IPAddress() = ipEntry.AddressList
Dim i As Integer = 0
While i < addr.Length
Console.WriteLine("IP Address {0}: {1} ", i, addr(i).ToString())
System.Math.Max(System.Threading.Interlocked.Increment(i), i - 1)
End While
Return 0
End Function