crashdemons Posted August 18, 2007 Posted August 18, 2007 Is there any way to reliably get the IP address of the person connecting on an accepted socket? ...By "reliably" I mean getting the real IP (or at least the IP from TCP/IP syntax) rather than trusting the client to tell the truth. Answer if you can , I am looking for some way to do IP-based bans/ignores for chat clients etc. Thank You. PS: I tried to search this but "IP" is too short to use as a keyword and 'TCP/IP', 'IPaddress' and etc. - didn't tell me much. My Projects - WindowDarken (Darken except the active window) Yahsmosis Chat Client (Discontinued) StarShooter Game (Red alert! All hands to battlestations!) YMSG Protocol Support (Discontinued) Circular Keyboard and OSK example. (aka Iris KB) Target Screensaver Drive Toolbar Thingy Rollup Pro (Minimize-to-Titlebar & More!) 2D Launcher physics example Ascii Screenshot AutoIt3 Quine Example ("Is a Quine" is a Quine.) USB Lock (Another system keydrive - with a toast.)
crashdemons Posted August 18, 2007 Author Posted August 18, 2007 (edited) *sighs* seem to be answering my own questions alot lately after alot of searching I found it here: Topic 50215 Func SocketToIP ($Socket) ;Retrives a clients IP address Local $Sockaddr = DLLStructCreate ("short;ushort;uint;char[8]") Local $aRet = DLLCall ("Ws2_32.dll", "int", "getpeername", "int", $Socket, _ "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 Edited August 18, 2007 by crashdemons My Projects - WindowDarken (Darken except the active window) Yahsmosis Chat Client (Discontinued) StarShooter Game (Red alert! All hands to battlestations!) YMSG Protocol Support (Discontinued) Circular Keyboard and OSK example. (aka Iris KB) Target Screensaver Drive Toolbar Thingy Rollup Pro (Minimize-to-Titlebar & More!) 2D Launcher physics example Ascii Screenshot AutoIt3 Quine Example ("Is a Quine" is a Quine.) USB Lock (Another system keydrive - with a toast.)
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