hi, also ich würde gerne die public ip der sockets herausfinden, welche auf meinen TCP server connecten,
habe dies hier gefunden:
[autoit]Func GetIP($Socket)
Local $SocketAddress
$SocketAddress = DllStructCreate("short;ushort;uint;char[8]")
$IP = DllCall("Ws2_32.dll", "int", "getpeername", "int", $Socket, "ptr", DllStructGetPtr($SocketAddress), "int*", DllStructGetSize($SocketAddress))
If Not @error And $IP[0] = 0 Then
$IP = DllCall("Ws2_32.dll", "str", "inet_ntoa", "int", DllStructGetData($SocketAddress, 3))
If Not @error Then $IP = $IP[0]
Else
$IP = @IPAddress1
EndIf
$SocketAddress = 0
Return $IP
EndFunc ;==>SocketToIp
jedoch bekomme ich immer fehler wenn diese funktion aufgerufen wird...
und zwar in diesen zeilen:
$IP = DllCall("Ws2_32.dll", "int", "getpeername", "int", $Socket, "ptr", DllStructGetPtr($SocketAddress), "int*", DllStructGetSize($SocketAddress))
$IP = DllCall("Ws2_32.dll", "str", "inet_ntoa", "int", DllStructGetData($SocketAddress, 3))
ich selbst habe sehr wenig ahnung von DLL daher weiß ich auch nicht wo ich eventuell dort etwas ändern muss!
MfG azunai