Sign in to follow this  
Followers 0
jaenster

Socket to ip

3 posts in this topic

I need help with this function.

It worked always very well. I never worked with dllcall but now i got an error, Please help me

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   ;==>_SocketToIP

Btw, This is the error

>Running:(3.2.10.0):C:\Program Files\AutoIt3\autoit3.exe "D:\dev\ai\webserver\Webserver.au3"    
D:\dev\ai\webserver\Webserver.au3 (101) : ==> "long_ptr", "int_ptr" and "short_ptr" DllCall() types have been deprecated.  Use "long*", "int*" and "short*" instead.: 
Local $aRet = DllCall("Ws2_32.dll", "int", "getpeername", "int", $SHOCKET, "ptr", DllStructGetPtr($sockaddr), "int_ptr", DllStructGetSize($sockaddr)) 

->11:09:35 AutoIT3.exe ended.rc:1

-jaenster

Share this post


Link to post
Share on other sites



Also... you need TCPStartup() before it works.

Lar.


f_mrcleansmalm_77ce002.jpgAutoIt has helped make me wealthy

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  
Followers 0