MerkurAlex Posted January 10, 2009 Share Posted January 10, 2009 Read the title! Also i cannot have the client send the ip i need to get it when they connect before the client sends anything. [quote name='PsaltyDS' post='635433' date='Jan 27 2009, 07:04 AM']Larry is a mass murderer?! It's always the quiet, clean cut, bald guys... [/quote] Link to comment Share on other sites More sharing options...
LarryDalooza Posted January 10, 2009 Share Posted January 10, 2009 socket2ip... i think Lar. AutoIt has helped make me wealthy Link to comment Share on other sites More sharing options...
MerkurAlex Posted January 10, 2009 Author Share Posted January 10, 2009 (edited) Hello Lar i was unable to find that function in the help file or on the forums.Well actually i found this where the person uses the function but he is not defining it... #113353 Edited January 10, 2009 by MerkurAlex [quote name='PsaltyDS' post='635433' date='Jan 27 2009, 07:04 AM']Larry is a mass murderer?! It's always the quiet, clean cut, bald guys... [/quote] Link to comment Share on other sites More sharing options...
Glyph Posted January 10, 2009 Share Posted January 10, 2009 (edited) ; Function to return IP Address from a connected socket. ;---------------------------------------------------------------------- Func SocketToIP($SHOCKET) Local $sockaddr, $aRet $sockaddr = DllStructCreate("short;ushort;uint;char[8]") $aRet = DllCall("Ws2_32.dll", "int", "getpeername", "int", $SHOCKET, _ "ptr", DllStructGetPtr($sockaddr), "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 ;==>SocketToIPUnder TCPRecv in the helpfile.Acutally the help file fails. Edited January 10, 2009 by Glyph tolle indicium Link to comment Share on other sites More sharing options...
MerkurAlex Posted January 10, 2009 Author Share Posted January 10, 2009 (edited) ... Brilliant lol thanks. Actually not brilliant... it returns 0 everytime. Edited January 10, 2009 by MerkurAlex [quote name='PsaltyDS' post='635433' date='Jan 27 2009, 07:04 AM']Larry is a mass murderer?! It's always the quiet, clean cut, bald guys... [/quote] Link to comment Share on other sites More sharing options...
Glyph Posted January 10, 2009 Share Posted January 10, 2009 ... Brilliant lol thanks.Actually not brilliant... it returns 0 everytime.Weird, I was getting the same returns on x64. Do you use x64 or x86? tolle indicium Link to comment Share on other sites More sharing options...
MerkurAlex Posted January 10, 2009 Author Share Posted January 10, 2009 No clue lol i got the laptop from work im pretty sure its x86... [quote name='PsaltyDS' post='635433' date='Jan 27 2009, 07:04 AM']Larry is a mass murderer?! It's always the quiet, clean cut, bald guys... [/quote] Link to comment Share on other sites More sharing options...
Kip Posted January 10, 2009 Share Posted January 10, 2009 Func _TCP_Server_ClientIP($hSocket) Local $pSocketAddress, $aReturn $pSocketAddress = DllStructCreate("short;ushort;uint;char[8]") $aReturn = DllCall("Ws2_32.dll", "int", "getpeername", "int", $hSocket, "ptr", DllStructGetPtr($pSocketAddress), "int*", DllStructGetSize($pSocketAddress)) If @error Or $aReturn[0] <> 0 Then Return 0 $aReturn = DllCall("Ws2_32.dll", "str", "inet_ntoa", "int", DllStructGetData($pSocketAddress, 3)) If @error Then Return 0 $pSocketAddress = 0 Return $aReturn[0] EndFunc MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API. Link to comment Share on other sites More sharing options...
Glyph Posted January 10, 2009 Share Posted January 10, 2009 (edited) Func _TCP_Server_ClientIP($hSocket) Local $pSocketAddress, $aReturn $pSocketAddress = DllStructCreate("short;ushort;uint;char[8]") $aReturn = DllCall("Ws2_32.dll", "int", "getpeername", "int", $hSocket, "ptr", DllStructGetPtr($pSocketAddress), "int*", DllStructGetSize($pSocketAddress)) If @error Or $aReturn[0] <> 0 Then Return 0 $aReturn = DllCall("Ws2_32.dll", "str", "inet_ntoa", "int", DllStructGetData($pSocketAddress, 3)) If @error Then Return 0 $pSocketAddress = 0 Return $aReturn[0] EndFunc Hah, The helpfile should be fixed. Thank-you for sharing that code with us! I remember seeing that fix before, but it slipped my mind! Edited January 10, 2009 by Glyph tolle indicium Link to comment Share on other sites More sharing options...
MerkurAlex Posted January 11, 2009 Author Share Posted January 11, 2009 Thank you kip! [quote name='PsaltyDS' post='635433' date='Jan 27 2009, 07:04 AM']Larry is a mass murderer?! It's always the quiet, clean cut, bald guys... [/quote] Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now