t8inevergreen Posted July 11, 2009 Share Posted July 11, 2009 Firstly, I've done some research on this topic and haven't been able to find anything. That doesn't mean that I haven't missed anything, so if this topic has already been discussed, I apologize in advance. I'm interested in setting up a remote command server to make remote IT support via UltraVNC a little smoother. In order to avoid punching port forwarding holes in my client's routers, I've decided to go the reverse connection route. I'd like to be able to see the IP of the client that is attempting to make the connection to aid in client identification and to provide the IP to use for the VNC connection. What are the options for obtaining the client's IP after TCPAccept? I know of netstat, but that seems a little clunky. Link to comment Share on other sites More sharing options...
dantay9 Posted July 12, 2009 Share Posted July 12, 2009 Right from the help file. It was in tcprecv though.; 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), "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 Link to comment Share on other sites More sharing options...
t8inevergreen Posted July 12, 2009 Author Share Posted July 12, 2009 Ah, damn, I looked right over that! Thank you very much, sir. Link to comment Share on other sites More sharing options...
dantay9 Posted July 12, 2009 Share Posted July 12, 2009 You're welcome. 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