GetData using MSWinsock.Winsock 
Author Message
 GetData using MSWinsock.Winsock

GetData using MSWinsock.Winsock"[in, out] VARIANT* data" is a by reference parameter and JScript doesn't support pass by reference...

--
Michael Harris
MVP Scripting

This is GetData method as exposed by the type library.

[id(0x00000044), helpstring("Retrieve data sent by the remote computer"), helpcontext(0x00053034)]
void GetData(
                [in, out] VARIANT* data,
                [in, optional] VARIANT type,
                [in, optional] VARIANT maxLen);

The VARIANT* data variable is not declared retval.  Is there anyway for me to get this out parameter using WSH?  Is there another object I can use whos interface declares this variable retval?  Here is my code:

var ws = WScript.CreateObject("MSWinsock.Winsock", "ws_")

ws.Protocol = 0
ws.Connect("chessclub.com", 21)
WScript.Sleep(5000)  

function ws_Connect()
{
        WScript.Echo("connected")

Quote:
}

function ws_DataArrival(length)
{
        WScript.Echo(length)
        var data
        data = "This string does not get over written"
        ws.GetData(data)
        WScript.Echo(data)
Quote:
}



Sun, 22 Sep 2002 03:00:00 GMT  
 GetData using MSWinsock.Winsock

Sounds like it's time for someone to do a rewrapper for JS, that will
take a function, and execute it, returning one of the parameters as the
first result code, then you can call another function on the object, to
still get back to real return code.  Would mean no one has to write JS
specific code, HMMM?

Quote:

> "[in, out] VARIANT* data" is a by reference parameter and JScript
> doesn't support pass by reference...
> --
> Michael Harris


> method as exposed by the type library.

> [id(0x00000044), helpstring("Retrieve data sent by the remote
> computer"), helpcontext(0x00053034)]
> void GetData(
>                 [in, out] VARIANT* data,
>                 [in, optional] VARIANT type,
>                 [in, optional] VARIANT maxLen);

> The VARIANT* data variable is not declared retval.  Is there anyway
> for me to get this out parameter using WSH?  Is there another object I
> can use whos interface declares this variable retval?  Here is my
> code:

> var ws = WScript.CreateObject("MSWinsock.Winsock", "ws_")

> ws.Protocol = 0
> ws.Connect("chessclub.com", 21)
> WScript.Sleep(5000)

> function ws_Connect()
> {
>         WScript.Echo("connected")
> }
> function ws_DataArrival(length)
> {
>         WScript.Echo(length)
>         var data
>         data = "This string does not get over written"
>         ws.GetData(data)
>         WScript.Echo(data)
> }



Wed, 25 Sep 2002 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Using MSWinsock.Winsock's GetData method from JScript?

2. winsock.GetData problem

3. Get HTML pages with mswinsock.winsock

4. Creating an instance of MSWinsock.Winsock gives error 0x80040112

5. ActiveX Object - MSWinsock.Winsock

6. using MSWINSOCK.OCX with Scripts

7. Using Winsock in a HTA

8. I cannot use WScript.CreateObject("MSWinsock.Winsock","Tcp1_") in .hta

9. VBScript & MSWinsock.winsock question on a Siemens MP370

10. Accessing MSChart DataGrid.GetData function from client-side VBScript

11. Accessing MSChart DataGrid.GetData function from client-side VBScript

12. MSWINSOCK.OCX with Vbscript

 

 
Powered by phpBB® Forum Software