Jump to content

Recommended Posts

Posted

Func SocketToIP($SHOCKET) ;gets ip of connected machine
    Local $sockaddr, $aRet

    $sockaddr = DllStructCreate("short;ushort;uint;char[8]")

    $aRet = DllCall("Ws2_32.dll", "int", "getpeername", "int", $SHOCKET, _
            "ptr", DllStructGetPtr($sockaddr), "int*", 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

Posted

I'm running on vista x64 and its working. Worked also on XP. Post the code... you are using perhaps. Are you passing the socket number to the function?

Posted

Solved, close

Mattraks,

Please do the rest of the forum a favour:

when you have an answer to your problem, stop editng your first post & topic title to something like "Close" or the several others you have that say "Delete".

Others searching the forum can't benefit from the solutions provided it they don't know what the original problem was.

Certainly you can edit the topic title and put [solved] or [Resolved] in front of the of the old title, but leave the original question or problem in your first post as is.

Thank you.

PS: I will also PM you a copy of this post in case you don't monitor your closed topics.

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
×
×
  • Create New...