Imports system.net
Public Class Form1
Inherits System.Windows.Forms.form
#Region "Windows Form Designer Generated Code"
Public Sub New ()
Mybase.new ()
'This call is required for the Windows Form Designer.
InitializeComponent ()
'Add any initialization after INITIALIZECOMPONENT ()
End Sub
'Form rewriting Dispose to clean up the list of components.
Protected Overloads Overrides Sub Dispose (Byval Disposing as Boolean)
IF Disposing then
IF not (Components Is Nothing) THEN
Components.dispose ()
END IF
END IF
Mybase.dispose (Disposing)
End Sub
'Windows Form Designer
Private Components as System.comPonentModel.icontainer
'Note: The following process is necessary for the Windows Form Designer.
'You can modify this process using the Windows Form Designer.
'Don't modify it using the code editor.
Friend Withevents Label1 As System.Windows.Forms.Label
Friend Withevents TextBox1 As System.Windows.Forms.TextBox
Friend Withevents Label2 As System.Windows.Forms.Label
Friend WitHevents TextBox2 as System.Windows.Forms.TextBox
Friend Withevents Label3 As System.Windows.Forms.label
Friend Withevents TextBox3 As System.Windows.Forms.TextBox
Friend Withevents Button1 As System.Windows.Forms.Button
Friend Withevents Button2 As System.Windows.Forms.Button
Me.label1 = new system.windows.forms.label
Me.TextBox1 = new system.windows.Forms.TextBox
Me.Label2 = new system.windows.forms.label
Me.TextBox2 = new system.windows.Forms.TextBox
Me.label3 = new system.windows.Forms.Label
Me.TextBox3 = new system.windows.Forms.TextBox
Me.Button1 = new system.windows.Forms.Button
Me.Button2 = new system.windows.Forms.Button
Me.suspendlayout ()
'
'Label1
'
Me.label1.location = new system.drawing.point (8, 16)
Me.Label1.name = "label1"
Me.label1.size = new system.drawing.size (48, 24) me.label1.tabindex = 0
Me.Label1.Text = "Host:"
'
'TextBox1
'
Me.TextBox1.Location = new system.drawing.point (72, 16)
Me.TextBox1.name = "textbox1"
Me.TextBox1.size = new system.drawing.size (152, 21)
Me.TextBox1.tabindex = 1
Me.TextBox1.text = ""
'
'Label2
'
Me.label2.location = new system.drawing.point (8, 64)
Me.Label2.name = "label2"
Me.label2.size = new system.drawing.size (48, 24)
Me.Label2.tabindex = 2
Me.Label2.text = "Alias:"
'
'TextBox2
'
Me.TextBox2.Location = new system.drawing.point (72, 64)
Me.TextBox2.multiline = true
Me.TextBox2.name = "TextBox2"
Me.TextBox2.size = new system.drawing.size (152, 72)
Me.TextBox2.tabindex = 3
Me.TextBox2.text = ""
'
'Label3
'
Me.label3.location = new system.drawing.point (8, 176)
Me.label3.name = "label3"
Me.label3.size = new system.drawing.size (56, 16)
Me.Label3.tabindex = 4
Me.Label3.Text = "IP address:"
'
'TextBox3
'
Me.TextBox3.Location = new system.drawing.point (72, 176)
Me.TextBox3.Multiline = true
Me.TextBox3.name = "TextBox3"
Me.TextBox3.size = new system.drawing.size (160, 72)
Me.TextBox3.tabindex = 5
Me.TextBox3.text = ""
'
'Button1
'
Me.Button1.dialogResult = system.windows.forms.dialogResult.cancel
Me.Button1.Location = new system.drawing.point (8, 272)
Me.Button1.name = "button1"
Me.button1.size = new system.drawing.size (96, 48)
Me.Button1.taBindex = 6
Me.Button1.text = "Host - >> IP" '
'Button2
'
Me.button2.location = new system.drawing.point (136, 272)
Me.Button2.name = "button2"
Me.button2.size = new system.drawing.size (96, 48)
Me.button2.tabindex = 7
Me.Button2.text = "ip - >> host"
'
'Form1
'
Me.autoscalebasesize = new system.drawing.size (6, 14)
Me.ClientSize = new system.drawing.size (328, 357)
Me.Controls.add (me.button2)
Me.Controls.add (me.button1)
Me.Controls.Add (Me.TextBox3)
Me.Controls.add (me.label3)
Me.Controls.add (Me.TextBox2)
Me.Controls.add (me.label2)
Me.Controls.add (Me.TextBox1)
Me.Controls.add (me.label1)
Me.FormBorderstyle = system.windows.Forms.FormBorderstyLle.Fixed3D
Me.imemode = system.windows.Forms.imemode.noControl
Me.Name = "Form1"
Me.Text = "Simple DNS Resolution"
Me.TransparencyKey = system.drawing.color.yellow
Me.ResumeLayout (false)
End Sub
#End region
Dim Localhostname as string
Dim LocalHostentry As iPhostentry
DIM aliaslist as string ()
DIM Addrlist as ipaddress ()
DIM I as integer
DIM STRTEMP AS STRING
Private Sub Form1_Load (Byval E AS System.Object, Byval E AS System.Eventargs) Handles MyBase.Load
Try
Localhostname = system.net.dns.gethostname
LocalHostentry = system.net.dns.getHostByname (localhostname)
TextBox1.text = localhostname
AliaSlist = localhostentry.Aliases
For i = 0 to aliaSList.Length - 1
Strtemp = Strtemp & AliasList (i) .tostring & ","
NEXT
TextBox2.text = strTemp
strTemp = ""
Addrlist = localhostentry.addresslist
For i = 0 to addrlist.length - 1
Strtemp = Strtemp & Addrlist (i) .tostring & ","
NEXT
TextBox3.text = strTemp
strTemp = ""
Catch exception
Msgbox ("Wrong", MsgBoxStyle.okonly, "Resolution Native Geological Error")
END TRY
End Sub
Private sub button1_click (byvale as system.object, byval e as system.eventargs) Handles Button1.click
Dim Hostname As String
Dim Hostentry as iphostentry
Dim Othername as string ()
DIM ipaddr as ipaddress ()
Hostname = TextBox1.text
Try
Hostname = TextBox1.text
Hostentry = system.net.dns.gethostbyname (Hostname)
Othername = Hostentry.Analiases
For i = 0 to tername.length - 1
Strtemp = Strtemp & Othersame (i) .tostring & ","
NEXT
TextBox2.text = strTemp
strTemp = ""
ipaddr = hostentry.addresslist
For i = 0 to ipaddr.length - 1
Strtemp = Strtemp & ipaddr (i) .tostring & ","
NEXT
TextBox3.text = strTemp
strTemp = ""
Catch exception
Msgbox ("Unable to Resolution", MSGBoxStyle.Okonly, "Resolution Error")
END TRY
End Sub
Private sub Button2_click (byvalgend, byval e as system.eventargs) Handles Button2.click
Dim Hostentry as iphostentry
DIM iPaddr as ipaddress
Try
ipaddr = ipaddress.parse (TextBox3.text)
Hostentry = system.net.dns.gethostbyaddress (iPaddr)
TextBox1.text = hostenTry.hostname
Catch exception
Msgbox ("Unable to Resolution", MSGBoxStyle.Okonly, "Resolution Error")
END TRY
End Sub
END CLASS