HexTcpQuery quick examples
Visual Basic 5.0
'Retrieves and displays HTML
'Be sure to select the Hexillion components
'in the Project|References dialog
Option Explicit
Sub main()
Dim oTcpq As New HexTcpQuery
Dim oLkup As New HexLookup
Dim lAddr As Long
Dim sHost As String, sQuery As String
sHost = "www.ibm.com"
lAddr = oLkup.LookUp(sHost)
If 0 <> lAddr Then
oTcpq.Timeout = 30000
oTcpq.RemoteAddr = lAddr
oTcpq.RemotePort = hexTcpqPortHttp
sQuery = "GET / HTTP/1.0" & vbCrLf & vbCrLf
Debug.Print oTcpq.Query(sQuery)
Else
Debug.Print "Lookup of " & sHost & " failed."
End If
End Sub
ASP with VBScript
<%@ LANGUAGE="VBSCRIPT" %>
<HTML>
<HEAD>
<TITLE>HexTcpQuery example -- Whois</TITLE>
</HEAD>
<BODY>
<%
set oTcpq=Server.CreateObject("Hexillion.HexTcpQuery")
set oLkup=Server.CreateObject("Hexillion.HexLookup")
oTcpq.RemoteAddr = oLkUp.LookUp("whois.internic.net")
oTcpq.RemotePort = 43 'Whois
oTcpq.Timeout = 30000
dim sQuery
sQuery = "help" & vbCrLf
%>
<pre>
<% = Server.HTMLEncode( oTcpq.Query( sQuery ) ) %>
</pre>
</BODY>
</HTML>
|