SandelPerieanu Posted May 6, 2008 Posted May 6, 2008 http://www.ostrosoft.com/oswinsck.aspInstallationfor use with Visual Basic 6 (any edition):1. download http://www.ostrosoft.com/download/oswinsck.zip2. from downloaded file unzip OSWINSCK.dll to Windows System directory3. run "regsvr32 OSWINSCK.dll" from command-linefile.vbs - is okTotal = 0 sBuffer = "" bClose = True Set oWinsock = CreateObject("OSWINSCK.Winsock") owinsock.Protocol = 0 WScript.ConnectObject oWinsock, "oWinsock_" oWinsock.Connect "129.6.15.28", 13 Sub oWinsock_OnClose() WScript.Echo sBuffer & "Total:" & Total oWinsock.CloseWinsock bClose = False Set oWinsock = Nothing End Sub Sub oWinsock_OnDataArrival(bytestotal) sBuffer = sBuffer & oWinsock.GetDataBuffer Total = Total + bytestotal End Sub While bClose WScript.Sleep 1 WEndfile.au3 - not work! what is wrong?$sbuffer = '' $total = '' $bclose = False $owinsock = ObjCreate("OSWINSCK.Winsock") $owinsock.Protocol = 0 ObjEvent($owinsock, "oWinsock_") $owinsock.Connect("129.6.15.29", 13) ; While Not $bclose Sleep(1) WEnd ; Func oWinsock_OnClose() $owinsock.CloseWinsock() MsgBox(0, "BytesReceived:" & $owinsock.BytesReceived, 'StringLen($sbuffer) = ' & _ StringLen($sbuffer) & @CRLF & '$total = ' & $total) $bclose = True $owinsock = 0 EndFunc ;==>oWinsock_OnClose ; Func oWinsock_OnDataArrival($bytestotal) $sbuffer &= $owinsock.GetDataBuffer() $total = $bytestotal EndFunc ;==>oWinsock_OnDataArrivalHELLLPPPP!i tried....but nothing...
Zedna Posted May 6, 2008 Posted May 6, 2008 - What type of error occurs - make strong error checking in case of problems $owinsock = ObjCreate("OSWINSCK.Winsock") If Not Isobj($owinsock) Then ... Also look at $oMyError = ObjEvent("AutoIt.Error","MyErrFunc") ; Initialize a COM error handler $owinsock = ObjCreate("OSWINSCK.Winsock") If @error Then ... ; This is my custom defined error handler Func MyErrFunc() Msgbox(0,"AutoItCOM Test","We intercepted a COM Error !" & @CRLF & @CRLF & _ "err.description is: " & @TAB & $oMyError.description & @CRLF & _ "err.windescription:" & @TAB & $oMyError.windescription & @CRLF & _ "err.number is: " & @TAB & hex($oMyError.number,8) & @CRLF & _ "err.lastdllerror is: " & @TAB & $oMyError.lastdllerror & @CRLF & _ "err.scriptline is: " & @TAB & $oMyError.scriptline & @CRLF & _ "err.source is: " & @TAB & $oMyError.source & @CRLF & _ "err.helpfile is: " & @TAB & $oMyError.helpfile & @CRLF & _ "err.helpcontext is: " & @TAB & $oMyError.helpcontext _ ) Local $err = $oMyError.number If $err = 0 Then $err = -1 SetError($err) ; to check for after this function returns Endfunc Resources UDF ResourcesEx UDF AutoIt Forum Search
SandelPerieanu Posted May 6, 2008 Author Posted May 6, 2008 in file.vbsWindows Script Host---------------------------54592 08-05-06 13:40:48 50 0 0 606.6 UTC(NIST) * TotalBytes:51---------------------------OK ---------------------------file.au3---------------------------BytesReceived:51---------------------------StringLen($sbuffer) = 0$total = 51---------------------------OK ---------------------------TotalBytesRecived from Au3 = TotalBytesRecived from vbs = 51but$sbuffer from au3 = nothingnot equal to sBuffer from vbs = 54592 08-05-06 13:40:48 50 0 0 606.6 UTC(NIST) * thanks
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now