Visual Basic 6.0
Visual Basic 6.0
Resolve a Hostname to an IP Address
See more Socket/SSL/TLS Examples
Demonstrates Socket.DnsLookup, which resolves a hostname and returns one numeric IP address.
Background. A maxWaitMs of 0 waits indefinitely; a positive value bounds the wait. Resolved results may be served from Chilkat's process-wide DNS cache.
Chilkat Visual Basic 6.0 Downloads
Dim socket As New ChilkatSocket
' Resolve a hostname to a numeric IP address, waiting up to 5 seconds.
Dim ipAddress As String
ipAddress = socket.DnsLookup("example.com",5000)
If (socket.LastMethodSuccess = 0) Then
Debug.Print socket.LastErrorText
Exit Sub
End If
Debug.Print "Resolved IP address: " & ipAddress