I have the following script:

Set oSck = WScript.CreateObject("MSWinsock.Winsock")
MsgBox(oSck.localIP)

oSck.RemoteHost = "64.233.167.99"
oSck.RemotePort = "80"
oSck.Protocol = 0
oSck.connect

myTimer = 0
Do While oSck.state <> 7 and myTimer < 10000
myTimer = myTimer + 1
Loop

MsgBox(myTimer)

Every time I run it, 10000 is output. This suggests that oSck.state is
never 7 (ie. that it has never connected). Any ideas as to why?

Re: unable to open connections with MSWinsock.Winsock by OfficeGuyGoesWild

OfficeGuyGoesWild
Thu Nov 09 18:41:33 CST 2006

I can't create this object on my pc so I can't test for you, but I have
found a similar problem which may be of some use:

http://www.dbforums.com/t885523.html


Marty
www.TheScriptLibrary.com


yawnmoth wrote:
> I have the following script:
>
> Set oSck = WScript.CreateObject("MSWinsock.Winsock")
> MsgBox(oSck.localIP)
>
> oSck.RemoteHost = "64.233.167.99"
> oSck.RemotePort = "80"
> oSck.Protocol = 0
> oSck.connect
>
> myTimer = 0
> Do While oSck.state <> 7 and myTimer < 10000
> myTimer = myTimer + 1
> Loop
>
> MsgBox(myTimer)
>
> Every time I run it, 10000 is output. This suggests that oSck.state is
> never 7 (ie. that it has never connected). Any ideas as to why?


Re: unable to open connections with MSWinsock.Winsock by Michael

Michael
Thu Nov 09 19:12:46 CST 2006

yawnmoth wrote:
> I have the following script:
>
> Set oSck = WScript.CreateObject("MSWinsock.Winsock")
> MsgBox(oSck.localIP)
>
> oSck.RemoteHost = "64.233.167.99"
> oSck.RemotePort = "80"
> oSck.Protocol = 0
> oSck.connect
>

You are probably just hogging waaayyyy too much cpu ;-)....

> myTimer = 0
> Do While oSck.state <> 7 and myTimer < 10000
> myTimer = myTimer + 1

WScript.Sleep 10

> Loop
>
> MsgBox(myTimer)
>
> Every time I run it, 10000 is output. This suggests that oSck.state
> is never 7 (ie. that it has never connected). Any ideas as to why?

--
Michael Harris
Microsoft MVP Scripting



Re: unable to open connections with MSWinsock.Winsock by yawnmoth

yawnmoth
Fri Nov 10 13:13:50 CST 2006


OfficeGuyGoesWild wrote:
> I can't create this object on my pc so I can't test for you, but I have
> found a similar problem which may be of some use:
>
> http://www.dbforums.com/t885523.html
I had to install Visual Studio 6 to get it working, myself.

Anyway, the link helped! I'm now able to send http requests (as
revealed by the network analyzer WireShark). Unfortunately, I'm not
sure how to actually display the contents? Here's the code that I
have, thus far:

Set oSck = WScript.CreateObject("MSWinsock.Winsock")
MsgBox(oSck.localIP)

oSck.RemoteHost = "64.233.167.99"
oSck.RemotePort = 80
oSck.connect

seconds = 0
Do While oSck.state <> 7 and seconds <> 25
WScript.Sleep 1000
seconds = seconds + 1
Loop

If seconds = 25 Then Wscript.Quit

oSck.sendData "GET / HTTP/1.0" & vbCrlf
oSck.sendData "Host: www.google.com" & vbCrlf & vbCrlf

oSck.getData InData, VBString
WriteData InData

MsgBox(InData)

As written, I get this error:

Windows Script Host

Script: C:\dirname\test.vbs
Line: 20
Char: 1
Error: Type mismatch: 'WriteData'
Code: 800A000D
Source: Microsoft VBScript runtime error

If I comment out the WriteData line, I get an empty alert box (when I
should, in fact, be getting an alert box with a lot of unparsed html).

Any ideas?


Re: unable to open connections with MSWinsock.Winsock by bob

bob
Fri Nov 10 13:17:24 CST 2006

use the xmlhttp object... much newer, much easier to use


"yawnmoth" <terra1024@yahoo.com> wrote in message
news:1163186030.581572.193620@k70g2000cwa.googlegroups.com...
>
> OfficeGuyGoesWild wrote:
>> I can't create this object on my pc so I can't test for you, but I have
>> found a similar problem which may be of some use:
>>
>> http://www.dbforums.com/t885523.html
> I had to install Visual Studio 6 to get it working, myself.
>
> Anyway, the link helped! I'm now able to send http requests (as
> revealed by the network analyzer WireShark). Unfortunately, I'm not
> sure how to actually display the contents? Here's the code that I
> have, thus far:
>
> Set oSck = WScript.CreateObject("MSWinsock.Winsock")
> MsgBox(oSck.localIP)
>
> oSck.RemoteHost = "64.233.167.99"
> oSck.RemotePort = 80
> oSck.connect
>
> seconds = 0
> Do While oSck.state <> 7 and seconds <> 25
> WScript.Sleep 1000
> seconds = seconds + 1
> Loop
>
> If seconds = 25 Then Wscript.Quit
>
> oSck.sendData "GET / HTTP/1.0" & vbCrlf
> oSck.sendData "Host: www.google.com" & vbCrlf & vbCrlf
>
> oSck.getData InData, VBString
> WriteData InData
>
> MsgBox(InData)
>
> As written, I get this error:
>
> Windows Script Host
>
> Script: C:\dirname\test.vbs
> Line: 20
> Char: 1
> Error: Type mismatch: 'WriteData'
> Code: 800A000D
> Source: Microsoft VBScript runtime error
>
> If I comment out the WriteData line, I get an empty alert box (when I
> should, in fact, be getting an alert box with a lot of unparsed html).
>
> Any ideas?
>



Re: unable to open connections with MSWinsock.Winsock by yawnmoth

yawnmoth
Fri Nov 10 13:51:24 CST 2006


bob m wrote:
> use the xmlhttp object... much newer, much easier to use

xmlhttp doesn't support anything other than http and the application
I'm ultimately trying to create isn't going to use http, anyway.

The reason I'm trying to do http right now is because it's easier. If
I can't do http then I sure can't do a protocol I'm less familiar with.


Re: unable to open connections with MSWinsock.Winsock by dNagel

dNagel
Fri Nov 10 14:13:41 CST 2006

so what is WriteData?? a function I would imagine but it's not
documented in
the source you provided?

D?


yawnmoth wrote:
> OfficeGuyGoesWild wrote:
>
>> I can't create this object on my pc so I can't test for you, but I have
>> found a similar problem which may be of some use:
>>
>> http://www.dbforums.com/t885523.html
>>
> I had to install Visual Studio 6 to get it working, myself.
>
> Anyway, the link helped! I'm now able to send http requests (as
> revealed by the network analyzer WireShark). Unfortunately, I'm not
> sure how to actually display the contents? Here's the code that I
> have, thus far:
>
> Set oSck = WScript.CreateObject("MSWinsock.Winsock")
> MsgBox(oSck.localIP)
>
> oSck.RemoteHost = "64.233.167.99"
> oSck.RemotePort = 80
> oSck.connect
>
> seconds = 0
> Do While oSck.state <> 7 and seconds <> 25
> WScript.Sleep 1000
> seconds = seconds + 1
> Loop
>
> If seconds = 25 Then Wscript.Quit
>
> oSck.sendData "GET / HTTP/1.0" & vbCrlf
> oSck.sendData "Host: www.google.com" & vbCrlf & vbCrlf
>
> oSck.getData InData, VBString
> WriteData InData
>
> MsgBox(InData)
>
> As written, I get this error:
>
> Windows Script Host
>
> Script: C:\dirname\test.vbs
> Line: 20
> Char: 1
> Error: Type mismatch: 'WriteData'
> Code: 800A000D
> Source: Microsoft VBScript runtime error
>
> If I comment out the WriteData line, I get an empty alert box (when I
> should, in fact, be getting an alert box with a lot of unparsed html).
>
> Any ideas?
>
>

Re: unable to open connections with MSWinsock.Winsock by dNagel

dNagel
Fri Nov 10 14:23:33 CST 2006

My last post was gleaned from this (failed) Javascript attempt...

http://www.webmasterdev.com/archive/index.php/t-168602.html

D.


yawnmoth wrote:
> OfficeGuyGoesWild wrote:
>
>> I can't create this object on my pc so I can't test for you, but I have
>> found a similar problem which may be of some use:
>>
>> http://www.dbforums.com/t885523.html
>>
> I had to install Visual Studio 6 to get it working, myself.
>
> Anyway, the link helped! I'm now able to send http requests (as
> revealed by the network analyzer WireShark). Unfortunately, I'm not
> sure how to actually display the contents? Here's the code that I
> have, thus far:
>
> Set oSck = WScript.CreateObject("MSWinsock.Winsock")
> MsgBox(oSck.localIP)
>
> oSck.RemoteHost = "64.233.167.99"
> oSck.RemotePort = 80
> oSck.connect
>
> seconds = 0
> Do While oSck.state <> 7 and seconds <> 25
> WScript.Sleep 1000
> seconds = seconds + 1
> Loop
>
> If seconds = 25 Then Wscript.Quit
>
> oSck.sendData "GET / HTTP/1.0" & vbCrlf
> oSck.sendData "Host: www.google.com" & vbCrlf & vbCrlf
>
> oSck.getData InData, VBString
> WriteData InData
>
> MsgBox(InData)
>
> As written, I get this error:
>
> Windows Script Host
>
> Script: C:\dirname\test.vbs
> Line: 20
> Char: 1
> Error: Type mismatch: 'WriteData'
> Code: 800A000D
> Source: Microsoft VBScript runtime error
>
> If I comment out the WriteData line, I get an empty alert box (when I
> should, in fact, be getting an alert box with a lot of unparsed html).
>
> Any ideas?
>
>

Re: unable to open connections with MSWinsock.Winsock by dNagel

dNagel
Fri Nov 10 14:22:18 CST 2006

try it this way... instead of

oSck.getData InData, VBString
WriteData InData

try this :

function oSck_DataArrival(totalbytes) {
Dim data
socket.GetData data, vbString
MsgBox data
}

D.

yawnmoth wrote:
> OfficeGuyGoesWild wrote:
>
>> I can't create this object on my pc so I can't test for you, but I have
>> found a similar problem which may be of some use:
>>
>> http://www.dbforums.com/t885523.html
>>
> I had to install Visual Studio 6 to get it working, myself.
>
> Anyway, the link helped! I'm now able to send http requests (as
> revealed by the network analyzer WireShark). Unfortunately, I'm not
> sure how to actually display the contents? Here's the code that I
> have, thus far:
>
> Set oSck = WScript.CreateObject("MSWinsock.Winsock")
> MsgBox(oSck.localIP)
>
> oSck.RemoteHost = "64.233.167.99"
> oSck.RemotePort = 80
> oSck.connect
>
> seconds = 0
> Do While oSck.state <> 7 and seconds <> 25
> WScript.Sleep 1000
> seconds = seconds + 1
> Loop
>
> If seconds = 25 Then Wscript.Quit
>
> oSck.sendData "GET / HTTP/1.0" & vbCrlf
> oSck.sendData "Host: www.google.com" & vbCrlf & vbCrlf
>
> oSck.getData InData, VBString
> WriteData InData
>
> MsgBox(InData)
>
> As written, I get this error:
>
> Windows Script Host
>
> Script: C:\dirname\test.vbs
> Line: 20
> Char: 1
> Error: Type mismatch: 'WriteData'
> Code: 800A000D
> Source: Microsoft VBScript runtime error
>
> If I comment out the WriteData line, I get an empty alert box (when I
> should, in fact, be getting an alert box with a lot of unparsed html).
>
> Any ideas?
>
>

Re: unable to open connections with MSWinsock.Winsock by dNagel

dNagel
Fri Nov 10 14:29:35 CST 2006

darnit... I do to much js lately...

function oSck_DataArrival(totalbytes)
Dim data
oSck.GetData data, vbString
MsgBox data
end function


dNagel wrote:
> try it this way... instead of
>
> oSck.getData InData, VBString
> WriteData InData
>
> try this :
>
> function oSck_DataArrival(totalbytes) {
> Dim data
> socket.GetData data, vbString
> MsgBox data
> }
>
> D.
>
> yawnmoth wrote:
>> OfficeGuyGoesWild wrote:
>>
>>> I can't create this object on my pc so I can't test for you, but I have
>>> found a similar problem which may be of some use:
>>>
>>> http://www.dbforums.com/t885523.html
>>>
>> I had to install Visual Studio 6 to get it working, myself.
>>
>> Anyway, the link helped! I'm now able to send http requests (as
>> revealed by the network analyzer WireShark). Unfortunately, I'm not
>> sure how to actually display the contents? Here's the code that I
>> have, thus far:
>>
>> Set oSck = WScript.CreateObject("MSWinsock.Winsock")
>> MsgBox(oSck.localIP)
>>
>> oSck.RemoteHost = "64.233.167.99"
>> oSck.RemotePort = 80
>> oSck.connect
>>
>> seconds = 0
>> Do While oSck.state <> 7 and seconds <> 25
>> WScript.Sleep 1000
>> seconds = seconds + 1
>> Loop
>>
>> If seconds = 25 Then Wscript.Quit
>>
>> oSck.sendData "GET / HTTP/1.0" & vbCrlf
>> oSck.sendData "Host: www.google.com" & vbCrlf & vbCrlf
>>
>> oSck.getData InData, VBString
>> WriteData InData
>>
>> MsgBox(InData)
>>
>> As written, I get this error:
>>
>> Windows Script Host
>>
>> Script: C:\dirname\test.vbs
>> Line: 20
>> Char: 1
>> Error: Type mismatch: 'WriteData'
>> Code: 800A000D
>> Source: Microsoft VBScript runtime error
>>
>> If I comment out the WriteData line, I get an empty alert box (when I
>> should, in fact, be getting an alert box with a lot of unparsed html).
>>
>> Any ideas?
>>
>>