国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

一個socket組件及其調用方法

2019-11-18 19:19:30
字體:
來源:轉載
供稿:網友

這個socket組件是由開發jmail的那家公司作的。
很老的一個版本了。不過挺好的。我一直在用。
比較穩定。以前發現xmlhttp在win2003 server上不太好。流量大了iis容易當掉。用這個組件倒還算穩定。

    paraHost ="www.survivalescaperooms.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


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 丰顺县| 高安市| 方山县| 云霄县| 松溪县| 苍溪县| 璧山县| 五台县| 京山县| 灌阳县| 叶城县| 松溪县| 贵州省| 沙坪坝区| 江源县| 康乐县| 永寿县| 海原县| 临猗县| 蒙自县| 宣武区| 渝北区| 义马市| 万安县| 金昌市| 资阳市| 仙居县| 定西市| 毕节市| 和林格尔县| 五家渠市| 巴林右旗| 张北县| 嘉鱼县| 泗阳县| 陆丰市| 南皮县| 固镇县| 普洱| 金门县| 沈阳市|