Jump to content

TCPRecv example broken in Windows Vista


Recommended Posts

Tryng to learn more about tcp / socket connections the example functions (TCPRecv TCPSend) in the help file work perfectly in 2k however when testing the server on a vista box errors out:

Line 80 (File "c:\example_server.au3"):

Local $aRet = DLLCall("Ws2_32.dll","int","getpeername","int",$SHOCKET,"ptr",DLLStructGetPtr($sockaddr),"int_ptr",DLLStructGetSize($sockaddr))

Error: "long_ptr", "int_ptr" and "short_ptr: DllCall() types have been deprecated. Use "long*", "int*" and "short*" instead.

then crashes.. >.<

the function where line 80 is in the example TCPRecv script is:

; Function to return IP Address from a connected socket.
;----------------------------------------------------------------------
Func SocketToIP($SHOCKET)
    Local $sockaddr = DLLStructCreate("short;ushort;uint;char[8]")

    Local $aRet = DLLCall("Ws2_32.dll","int","getpeername","int",$SHOCKET, _
            "ptr",DLLStructGetPtr($sockaddr),"int_ptr",DLLStructGetSize($sockaddr))
    If Not @error And $aRet[0] = 0 Then
        $aRet = DLLCall("Ws2_32.dll","str","inet_ntoa","int",DLLStructGetData($sockaddr,3))
        If Not @error Then $aRet = $aRet[0]
    Else
        $aRet = 0
    EndIf

    $sockaddr = 0

    Return $aRet
EndFunc

can you simply replace the dll file ehh modify that function to work with vista's version accordingly lol or reinstall xp >.<

Don't let that status fool you, I am no advanced memeber!

Link to comment
Share on other sites

for sanity sake i did test the server (TCPRecv Example) on xp and client (TCPSend Example) on vista and that sends fine which again makes me think that its a difference in the dll's...

vista reports:

Ws2_32.dll 174kb version: 6.0.6000.16386

xp:

81kb version: 5.1.2600.2180 (xpsp_sp2.....

Don't let that status fool you, I am no advanced memeber!

Link to comment
Share on other sites

look in the help file of 3.2.10.0 at dllcall

long_ptr needs to be changed to long*

and the others respectively

This has already been done for the next version for when that is released.

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

wow thanks so soo simple i overlooked the obvious...

line 81 is now:

"ptr",DLLStructGetPtr($sockaddr),"int*",DLLStructGetSize($sockaddr))

and it works that int_ptr is the only place i could find anything ptr in the func and it now seems to work without error now to disect and abuse it!

:)

thx again

Don't let that status fool you, I am no advanced memeber!

Link to comment
Share on other sites

  • 3 weeks later...

Hi, I'm new for this (known AutoIt for years but still learning), can anyone help me with a quick dll reading to check Ws2_32.dll's version beacuse I wouldn't really write my code twice, one for Vista one for XP. Or if you have any other idea, please help. Thanks

.... /me nub ... what is filegetversion thingie :D

Edited by AdamusTorK

[quote name='PsaltyDS']so what is your ilegitimate purpose here?[/quote]

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...