Help us understand the problem. What is going on with this article?

vbsの作法 その44

概要

vbsの作法調べてみた。
winsock使ってみる。
生httpを見たかった。

写真

image

環境

windows7 64bit

サンプルコード

Dim oWin
Dim sURL
Dim sPage
Dim sServer
Dim nPort
Dim sBuffer
Dim sSource
Dim bClose
Dim App6
Dim Appflg

Sub App6_exit()
    Appflg = 2
End Sub

Sub App6_ok()
    sServer = "www.ostrosoft.com"
    sPage = "/"
    Set oWin = CreateObject("OSWINSCK.Winsock")
    WScript.ConnectObject oWin, "soc_"
    oWin.Connect CStr(sServer), CLng(nPort)
    While Not bClose
        WScript.Sleep 100
    Wend
End Sub

Sub soc_OnClose()
    oWin.CloseWinsock
    App6.text = sSource
    bClose = True
    Set oWin = Nothing
End Sub

Sub soc_OnConnect()
    oWin.SendData "GET " & sPage & " HTTP/1.0" & vbCrLf & vbCrLf
End Sub

Sub soc_OnDataArrival(ByVal bytesTotal)
    oWin.GetData sBuffer
    sSource = sSource & sBuffer
End Sub

Sub soc_OnError(ByVal Number, Description, ByVal Scode, ByVal Source, ByVal HelpFile, ByVal HelpContext, CancelDisplay)
    Msgbox Number & ": " & Description
    oWin.CloseWinsock
End Sub

Set App6 = Createobject("OHIcompo6.srv")
WScript.ConnectObject App6, "App6_"
App6.text = ""
sURL = ""
sPage = ""
sServer = ""
nPort = 80
sBuffer = ""
sSource = ""
bClose = False
sProxy = ""
Do
    WScript.Sleep(100)
    App6.ping
Loop until Appflg = 2
Set App6 = Nothing



以上。

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした