الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

الحصول على IPAddress من URL الموقع

مغلق
بدأه محمد سامر أبو سلو في 27 أغسطس 2005 · 2 رد · 555 مشاهدة · في Microsoft Visual Basic.NET
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

في قسم الاستيرادات في بداية الملف

Imports System.Net
Imports System.Net.Sockets

ضع على الفورم صندوق نصوص و زرا و صندوق قائمة وأدخل الكود التالي في الزر

        ListBox1.Items.Clear()

        Dim hostName As String = TextBox1.Text

        Try
            ' Call the GetHostByName method, passing a DNS style host name(for example,
            ' "www.contoso.com") as an argument to obtain an IPHostEntry instance, that 
            ' contains information for the specified host.

            Dim hostInfo As IPHostEntry = Dns.GetHostByName(hostName)
            ' Get the IP address list that resolves to the host names contained in 
            ' the Alias property.
            Dim address As IPAddress() = hostInfo.AddressList
            ' Get the alias names of the the addresses in the IP address list.
            Dim [alias] As [String]() = hostInfo.Aliases

            ListBox1.Items.Add(("Host name : " + hostInfo.HostName))
            ListBox1.Items.Add(ControlChars.Cr + "Aliases : ")
            Dim index As Integer
            For index = 0 To [alias].Length - 1
                ListBox1.Items.Add([alias](index))
            Next index
            ListBox1.Items.Add(ControlChars.Cr + "IP address list : ")

            For index = 0 To address.Length - 1
                ListBox1.Items.Add(address(index))
            Next index
        Catch ec As SocketException
            ListBox1.Items.Add("SocketException caught!!!")
            ListBox1.Items.Add(("Source : " + ec.Source))
            ListBox1.Items.Add(("Message : " + ec.Message))
            ec = Nothing
        Catch ea As ArgumentNullException
            ListBox1.Items.Add("ArgumentNullException caught!!!")
            ListBox1.Items.Add(("Source : " + ea.Source))
            ListBox1.Items.Add(("Message : " + ea.Message))
            ea = Nothing
        Catch eb As Exception
            ListBox1.Items.Add("Exception caught!!!")
            ListBox1.Items.Add(("Source : " + eb.Source))
            ListBox1.Items.Add(("Message : " + eb.Message))
            eb = Nothing
        End Try

ومرفق أيضا المثال جاهز

WindowsApplication1.zip

عن عائشة رضي الله عنها أن النبي صلى الله عليه وسلم قال: إن الله يحب إذا عمل أحدكم عملا أن يتقنه

نعيب زماننا والعيب فينا ... وما لزماننا عيب سوانا

ونهجو ذا الزمان بغير ذنب ... ولو نطق الزمان لنا هجانا

محمد سامر أبو سلو

#2

10/10 يا اخ سامر

شكرا علي مشاركاتك ومواضيعك الحلوه

سبحان الله وبحمده سبحان الله العظيم

لا اله الا الله محمدا رسول الله

اللهم اغفر للمسلمين والمسلمات والمؤمنين والمؤمنات الاحياء منهم والاموات

ـــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ

حمل كريستال ريبورت 10 اربعه اصدارات

ww12kz.jpg

hashad.jpg

هذا الموضوع مغلق.

مواضيع مشابهة