Jump to content
Sign in to follow this  
AzKay

WinSock Control.

Recommended Posts

AzKay

$oMyError = ObjEvent("AutoIt.Error", "COMErrFunc")

$WinSock = ObjCreate("MSWinsock.Winsock.1")
$oX = ObjEvent($WinSock, "Sock_")
$WinSock.Connect("127.0.0.1", 65432)
Do
Until $WinSock.State = 7
AdlibEnable("Sock_DataArrival", 1)
$WinSock.SendData("hi")

While 1
    ;Sleep(10)
WEnd

$WinSock.Close

Func Sock_DataArrival() ;$totalBytes
    $strData = ""
    $WinSock.GetData($strData)
    If $strData <> "" Then ConsoleWrite($strData & @CRLF)
EndFunc

Func COMErrFunc()
    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
    Exit
EndFunc ;==>COMErrFuncoÝ÷ Ù'«½êÚºÚ"µÍÔÑTTÌÌÎÉÌÌÎÈÝYHÝ    ÌÌÎÉÌÌÎÉÌÌÎÉÌÌÎÉÌÌÎÉÌÌÎÉÌÌÎÉÌÌÎÉÌÌÎÉÌÌÎÉÌÌÎÉÌÌÎÉÌÌÎÉÌÌÎÉÌÌÎÂÌÍÙ×ÒTH    ][ÝÌLËI][ÝÂÈÝHÔÙXÙÂÏOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOBÔÝ

BÈÜX]HHÝ[[È ][ÝÔÓÐÒÑU ][ÝÂÏOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOBÌÍÓXZ[ÛØÚÙ]HÔÝ[  ÌÍÙ×ÒT
MÌL
BY  ÌÍÓXZ[ÛØÚÙ]HLH[^]ÈÛÚÈÜÛY[ÛÛXÝ[ÛËKKKKKKKKKKKKKKKKKKKBÚ[HBÌÍÐÛÛXÝYÛØÚÙ]HÔXØÙ
    ÌÍÓXZ[ÛØÚÙ]
BY  ÌÍÐÛÛXÝYÛØÚÙ] ÝÏH[ÙØÞ
    ][ÝÉ][ÝË    ][ÝÛ^HÙHÛY[ÛÛXÝY ][ÝÊB^]ÛÜ[[Ú[HBIÌÍÛÔXÝHÔXÝ   ÌÍÐÛÛXÝYÛØÚÙ]

JBRY    ÌÍÛÔXÝ ÉÝÈ  ][ÝÉ][ÝÈ[BNÓÙÐÞ
    ][ÝÉ][ÝË    ÌÍÛÔXÝBBUÔÙ[
    ÌÍÐÛÛXÝYÛØÚÙ] ][ÝÜÙÙÙÉ][ÝÊBQ[[

GetData reference.

GetData VB6 example.

According the the example there, it GetData should be working.

But it isnt. I tried with the event, and a adlib.

Any ideas?

Edited by AzKay

# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
Share on other sites
AzKay

And if you dont have the WinSock control, I believe it can be found HERE.


# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
Share on other sites
AzKay

"Bump".


# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
Share on other sites
AzKay

"Bump".


# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
Share on other sites
AzKay

Bump.


# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
Share on other sites
evilertoaster

AzKay, from what I understand this code should work-

;client
dim $sBuffer
$oMyError = ObjEvent("AutoIt.Error", "COMErrFunc")
$WinSock = ObjCreate("MSWinsock.Winsock.1")
$oX = ObjEvent($WinSock, "Sock_")
$WinSock.Connect("127.0.0.1", 1000)

Do  
Until $WinSock.State = 7

$WinSock.SendData("hi")

While 1
    Sleep(100)
WEnd

$WinSock.Close

Func Sock_DataArrival($total)
    $WinSock.GetData($sBuffer)
EndFunc

Func COMErrFunc()
    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
    Exit
EndFunc ;==>COMErrFuncoÝ÷ Ù«­¢+ÙQ
AMÑÉÑUÀ ¤(ÀÌØí5¥¹M½­ÐôQ
A1¥ÍѸ ÅÕ½ÐìÄÈܸÀ¸À¸ÄÅÕ½Ðì°ÄÀÀÀ¤)%ÀÌØí5¥¹M½­Ðô´ÄQ¡¸á¥Ð()]¡¥±Ä($ÀÌØí
½¹¹ÑM½­ÐôQ
AÁÐ ÀÌØí5¥¹M½­Ð¤(%%ÀÌØí
½¹¹ÑM½­ÐÐìôÀQ¡¸($%µÍ½à À°ÅÕ½ÐìÅÕ½Ðì°ÅÕ½ÐíµäÍÉÙÈ´
±¥¹Ð
½¹¹ÑÅÕ½Ðì¤($%á¥Ñ1½½À(%¹%)]¹()]¡¥±Ä(ÀÌØí½IØôQ
AIØ ÀÌØí
½¹¹ÑM½­Ð°ÈÀÐÔ¤(%ÀÌØí½IرÐìÐìÅÕ½ÐìÅÕ½ÐìQ¡¸(Q
AM¹ ÀÌØí
½¹¹ÑM½­Ð°ÅÕ½ÐíÍÍÍÌÅÕ½Ðì¤(¹%)]¹oÝ÷ Ø­×hzÉ÷öÒÊç$Ó~­¢Ö¥{ayëÞØZÙ^®Øhºr¢íý[z+HJ­¶)ණmu«Z"Ýý²,²&åzØb²+nèØhºb·lj[(¦,¹^Áíý­ë"rv§+p®à¶«yªÞ²«±ç±jjezËh~Ø¢é˧¶Ú+z+µ«,¹ÈZÛ{Z¶Ø^ÊØbJÒ'µê޲ا¢*.¶¼­¢ëjv«­¬²Ø^­ç"z÷«nçßz¶®¶­sfFÒb33c·4'VffW%³#Тb33c¶ô×W'&÷"Òö&¤WfVçBgV÷C´WFôBäW'&÷"gV÷C²ÂgV÷C´4ôÔW'$gVæ2gV÷C²¢b33cµvå6ö6²Òö&¤7&VFRgV÷C´Õ5vç6ö6²åvç6ö6²ãgV÷C²¢b33c¶õÒö&¤WfVçBb33cµvå6ö6²ÂgV÷Cµ6ö6µògV÷C²¢b33cµvå6ö6²ä6öææV7BgV÷C³#rãããgV÷C²Â ¤Fð¥VçFÂb33cµvå6ö6²å7FFRÒp ¢b33cµvå6ö6²å6VæDFFgV÷C¶gV÷C² ¥vÆR¢6ÆVW¥tVæ@ ¢b33cµvå6ö6²ä6Æ÷6P ¤gVæ26ö6µôFF'&fÂb33c·F÷F b33cµvå6ö6²ävWDFFb33c·4'VffW"¤VæDgVæ0 ¤gVæ24ôÔW'$gVæ2¢×6t&÷ÂgV÷C´WFôD4ôÒFW7BgV÷C²ÂgV÷CµvRçFW&6WFVB4ôÒW'&÷"b333²gV÷C²fײ5$Äbfײ5$Äbfײð¢gV÷C¶W'"æFW67&Föâ3¢gV÷C²fײD"fײb33c¶ô×W'&÷"æFW67&Föâfײ5$Äbfײð¢gV÷C¶W'"çvæFW67&Föã¢gV÷C²fײD"fײb33c¶ô×W'&÷"çvæFW67&Föâfײ5$Äbfײð¢gV÷C¶W'"æçVÖ&W"3¢gV÷C²fײD"fײWb33c¶ô×W'&÷"æçVÖ&W"Âfײ5$Äbfײð¢gV÷C¶W'"æÆ7FFÆÆW'&÷"3¢gV÷C²fײD"fײb33c¶ô×W'&÷"æÆ7FFÆÆW'&÷"fײ5$Äbfײð¢gV÷C¶W'"ç67&FÆæR3¢gV÷C²fײD"fײb33c¶ô×W'&÷"ç67&FÆæRfײ5$Äbfײð¢gV÷C¶W'"ç6÷W&6R3¢gV÷C²fײD"fײb33c¶ô×W'&÷"ç6÷W&6Rfײ5$Äbfײð¢gV÷C¶W'"æVÇfÆR3¢gV÷C²fײD"fײb33c¶ô×W'&÷"æVÇfÆRfײ5$Äbfײð¢gV÷C¶W'"æVÇ6öçFWB3¢gV÷C²fײD"fײb33c¶ô×W'&÷"æVÇ6öçFWBð¢¢Æö6Âb33c¶W'"Òb33c¶ô×W'&÷"æçVÖ&W ¢bb33c¶W'"ÒFVâb33c¶W'"ÒÓ¢6WDW'&÷"b33c¶W'"²Fò6V6²f÷"gFW"F2gVæ7Föâ&WGW&ç0¢W@¤VæDgVæ2³ÓÒfwC´4ôÔW'$gVæ0

It hard crashes, which seems odd (com error maybe, but not a hard crash)... this was assuming that it might be a byte-array or somthing but it isn't.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×