Platforms to show: All Mac Windows Linux Cross-Platform
Required plugins for this example: MBS Network Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Network/lookup dns
This example is the version from Sun, 17th Mar 2012.
Project "lookup dns.xojo_binary_project"
Class Window1 Inherits Window
Control Domain Inherits TextField
ControlInstance Domain Inherits TextField
End Control
Control StaticText1 Inherits Label
ControlInstance StaticText1 Inherits Label
End Control
Control PushButton1 Inherits PushButton
ControlInstance PushButton1 Inherits PushButton
EventHandler Sub Action()
lookup
End EventHandler
End Control
Control Separator1 Inherits Separator
ControlInstance Separator1 Inherits Separator
End Control
Control StaticText2 Inherits Label
ControlInstance StaticText2 Inherits Label
End Control
Control StaticText3 Inherits Label
ControlInstance StaticText3 Inherits Label
End Control
Control StaticText4 Inherits Label
ControlInstance StaticText4 Inherits Label
End Control
Control fname Inherits Label
ControlInstance fname Inherits Label
End Control
Control faddress Inherits Label
ControlInstance faddress Inherits Label
End Control
Control faddresstype Inherits Label
ControlInstance faddresstype Inherits Label
End Control
Control ListBox1 Inherits ListBox
ControlInstance ListBox1 Inherits ListBox
End Control
Control ListBox2 Inherits ListBox
ControlInstance ListBox2 Inherits ListBox
End Control
Function formataddress(s as string) As string
dim c as integer
dim i as integer
dim t as String
c=len(s)
for i=1 to c
t=t+str(asc(mid(s,i,1)))
if i<c then
t=t+"."
end if
next
Return t
End Function
Sub lookup()
dim d as DNSLookupMBS
dim i,c as integer
d = DNSLookupMBS.LookupHostbyName(Domain.Text)
if d=nil then
MsgBox "Query failed."
else
fname.text=d.Name
faddress.text=formataddress(d.Address)
faddresstype.text=str(d.AddressType)
ListBox1.DeleteAllRows
ListBox2.DeleteAllRows
c=d.AddressesCount-1
for i=0 to c
ListBox2.AddRow formataddress(d.Addresses(i))
next
c=d.AliasCount-1
for i=0 to c
ListBox1.AddRow d.Aliases(i)
next
end if
End Sub
End Class
MenuBar Menu
MenuItem UntitledMenu3 = ""
MenuItem UntitledMenu2 = "File"
MenuItem FileQuit = "Quit"
MenuItem UntitledMenu0 = "Edit"
MenuItem EditUndo = "Undo"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "Cut"
MenuItem EditCopy = "Copy"
MenuItem EditPaste = "Paste"
MenuItem EditClear = "Clear"
End MenuBar
Class App Inherits Application
End Class
End Project
The items on this page are in the following plugins: MBS Network Plugin.