This socket component is made by the company that developed jmail.
A very old version. But it's pretty good. I use it all the time.
Relatively stable. I previously found that xmlhttp did not work well on win2003 server. If the traffic is large, IIS will be easily crashed. This component is quite stable.
paraHost =" www.downcodes.com " ' host
paraPort = 80 'port
paraFileUrl="/test/test.htm"
Set Socket = CreateObject("Socket.TCP")
Socket.Host = paraHost & ":" & paraPort
Socket.Timeout = paraTimeout
If Err.Number <> 0 Then Err.Clear
Socket.open
' timeout error = 8000ffff
Socket.SendLine "GET " & paraFileUrl & " HTTP/1.0"
Socket.SendLine "HOST: " & paraHost
Socket.SendLine ""
Socket.SendLine ""
'Sleep 200
Socket.WaitForDisconnect
If Err.Number <> 0 Then
response.write Err.Number & " -- " & Err.Description
Err.Clear
Else
response.write HTTPResponse(Socket.Buffer, 1) ' output text from socket
End If
Socket.Close
Set Socket = Nothing
Private Function HTTPResponse(ByVal toHTTPResponse, ByVal whichHTTPResponse)
On Error Resume Next
Dim HTTPResponseDelimiter
HTTPResponseDelimiter = Chr(13) & Chr(10) & Chr(13) & Chr(10)
If (InStr(1, toHTTPResponse, HTTPResponseDelimiter, vbBinaryCompare) <> 0) Then
Select Case whichHTTPResponse
Case 0 'Header
HTTPResponse = Mid(toHTTPResponse, 1, (InStr(1, toHTTPResponse, HTTPResponseDelimiter, vbBinaryCompare) - 1))
Case 1 'Body
HTTPResponse = Mid(toHTTPResponse, (InStr(1, toHTTPResponse, HTTPResponseDelimiter, vbBinaryCompare) + Len(HTTPResponseDelimiter)), (Len(toHTTPResponse) - (InStr(1, toHTTPResponse, HTTPResponseDelimiter, vbBinaryCompare) - 1)))
End Select
End If
End Function