Platforms to show: All Mac Windows Linux Cross-Platform

Back to DNSLookupMBS class.

DNSLookupMBS.FormatIP(ip as string) as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Network MBS Network Plugin 10.4 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Formats an IP from binary representation into string representation.
Example
dim s as string = DNSLookupMBS.ParseIPv4("65.66.67.68")

MsgBox s // in binary representation of that IP

dim t as string = DNSLookupMBS.FormatIP(s)

MsgBox t

Formats both IPv4 and IPv6 IP addresses in binary representation into human readable text.
On Windows IPv6 is only supported on Windows Vista and newer.
Returns empty string on failure.

Some examples using this method:

DNSLookupMBS.LookupHostbyAddress(HostAddressBinary as string) as DNSLookupMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Network MBS Network Plugin 11.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Queries the DNS server for information about a host IP address.
Example
dim l as DNSLookupMBS
dim a as string

a = DNSLookupMBS.ParseIPv4("17.254.0.91")

// try it...
l = DNSLookupMBS.LookupHostbyAddress(a)

// success...
MsgBox l.Name

The address must be a 4 byte IP address like the ones returned by DNSLookupMBS.Address.
Returns nil on any error.

DNSLookupMBS.LookupHostbyAddressMT(HostAddressBinary as string) as DNSLookupMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Network MBS Network Plugin 11.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Queries the DNS server for information about a host IP address.
Example
dim l as DNSLookupMBS
dim a as string

a = DNSLookupMBS.ParseIPv4("17.254.0.91")

// try it...
l = DNSLookupMBS.LookupHostbyAddressMT(a)

// success...
MsgBox l.Name

Same as LookupHostbyAddress, but with additional multithreading.

The address must be a 4 byte IP address like the ones returned by DNSLookupMBS.Address.
Returns nil on any error.

The work is performed on a preemptive thread, so this function does not block the application and can yield time to other Xojo threads. Must be called in a Xojo thread to enjoy benefits. If called in main thread will block, but keep other background threads running.

DNSLookupMBS.LookupHostbyName(HostName as string) as DNSLookupMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Network MBS Network Plugin 11.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Queries the DNS server for information about a host name.
Example
dim s as DNSLookupMBS = DNSLookupMBS.LookupHostbyName("www.monkeybreadsoftware.de")

dim c as Integer = s.AddressesCount-1
for i as Integer = 0 to c
dim ss as string = s.Addresses(i)
print str(s.FormatIP(ss))
next

Will fail if you pass an IP as an host. (e.g. 10.20.30.40)
Returns nil on any error.

See also:

Some examples using this method:

DNSLookupMBS.LookupHostbyName(HostName as string, AddressType as Integer) as DNSLookupMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Network MBS Network Plugin 11.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Queries the DNS server for information about a host name.
Example
dim s as DNSLookupMBS = DNSLookupMBS.LookupHostbyName("ipv6.google.com", DNSLookupMBS.AddressTypeIPv6)

if s<>nil then
dim c as Integer = s.AddressesCount-1
for i as Integer = 0 to c
dim ss as string = s.Addresses(i)
print str(s.FormatIP(ss))
next
end if

s = DNSLookupMBS.LookupHostbyName("www.six.heise.de", DNSLookupMBS.AddressTypeIPv6)

if s<>nil then
dim c as Integer = s.AddressesCount-1
for i as Integer = 0 to c
dim ss as string = s.Addresses(i)
print str(s.FormatIP(ss))
next
end if

Will fail if you pass an IP as an host. (e.g. 10.20.30.40)
Returns nil on any error.

IPv6 on Windows does not work with this method.

See also:

DNSLookupMBS.LookupHostbyNameMT(HostName as string) as DNSLookupMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Network MBS Network Plugin 11.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Queries the DNS server for information about a host name.
Example
dim s as DNSLookupMBS = DNSLookupMBS.LookupHostbyNameMT("www.monkeybreadsoftware.de")

dim c as Integer = s.AddressesCount-1
for i as Integer = 0 to c
dim ss as string = s.Addresses(i)
print str(s.FormatIP(ss))
next

Same as LookupHostbyName, but with additional multithreading.

Will fail if you pass an IP as an host. (e.g. 10.20.30.40)
Returns nil on any error.

The work is performed on a preemptive thread, so this function does not block the application and can yield time to other Xojo threads. Must be called in a Xojo thread to enjoy benefits. If called in main thread will block, but keep other background threads running.

See also:

Some examples using this method:

DNSLookupMBS.LookupHostbyNameMT(HostName as string, AddressType as Integer) as DNSLookupMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Network MBS Network Plugin 11.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Queries the DNS server for information about a host name.
Example
dim s as DNSLookupMBS = DNSLookupMBS.LookupHostbyNameMT("ipv6.google.com", DNSLookupMBS.AddressTypeIPv6)

if s<>nil then
dim c as Integer = s.AddressesCount-1
for i as Integer = 0 to c
dim ss as string = s.Addresses(i)
print str(s.FormatIP(ss))
next
end if

s = DNSLookupMBS.LookupHostbyNameMT("www.six.heise.de", DNSLookupMBS.AddressTypeIPv6)

if s<>nil then
dim c as Integer = s.AddressesCount-1
for i as Integer = 0 to c
dim ss as string = s.Addresses(i)
print str(s.FormatIP(ss))
next
end if

Same as LookupHostbyName, but with additional multithreading.

Will fail if you pass an IP as an host. (e.g. 10.20.30.40)
Returns nil on any error.

IPv6 on Windows does not work with this method.

The work is performed on a preemptive thread, so this function does not block the application and can yield time to other Xojo threads. Must be called in a Xojo thread to enjoy benefits. If called in main thread will block, but keep other background threads running.

See also:

DNSLookupMBS.ParseIPv4(ip as string) as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Network MBS Network Plugin 10.4 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Parses an IP address in IPv4 format.
Example
dim s as string = DNSLookupMBS.ParseIPv4("65.66.67.68")

MsgBox s // in binary representation of that IP

dim t as string = DNSLookupMBS.FormatIP(s)

MsgBox t

Returns empty string on failure.
Works only for IPv4 strings.

DNSLookupMBS.ParseIPv6(ip as string) as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Network MBS Network Plugin 10.4 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Parses an IP address in IPv6 format.
Example
dim s as string = DNSLookupMBS.ParseIPv6("2001:0db8:85a3:08d3:1319:8a2e:0370:7344")

MsgBox s // in binary representation of that IP

dim t as string = DNSLookupMBS.FormatIP(s)

MsgBox t

Returns empty string on failure.
Works only for IPv6 strings.

The items on this page are in the following plugins: MBS Network Plugin.


The biggest plugin in space...