Sample code for 30+ languages & platforms
Classic ASP

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 Classic ASP Downloads

Classic ASP
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<%
set socket = Server.CreateObject("Chilkat.Socket")

'  Resolve a hostname to a numeric IP address, waiting up to 5 seconds.
ipAddress = socket.DnsLookup("example.com",5000)
If (socket.LastMethodSuccess = 0) Then
    Response.Write "<pre>" & Server.HTMLEncode( socket.LastErrorText) & "</pre>"
    Response.End
End If

Response.Write "<pre>" & Server.HTMLEncode( "Resolved IP address: " & ipAddress) & "</pre>"

%>
</body>
</html>