Jump to content

Recommended Posts

Posted

So I'm using a modified version of the RemoteAutoit script to allow remote restarts for a server i'm running. It works fine, but I want to add logging to it and i was wondering if there was any way to retrieve the IP from the TCP functions (TCPRecv, Accept etc..)

Any help would be much appreciated.

~cdkid

AutoIt Console written in C#. Write au3 code right at the console :D_FileWriteToLineWrite to a specific line in a file.My UDF Libraries: MySQL UDF Library version 1.6 MySQL Database UDF's for AutoItI have stopped updating the MySQL thread above, all future updates will be on my SVN. The svn location is:kan2.sytes.net/publicsvn/mysqlnote: This will still be available, but due to my new job, and school hours, am no longer developing this udf.My business: www.hirethebrain.com Hire The Brain HireTheBrain.com Computer Consulting, Design, Assembly and RepairOh no! I've commited Scriptocide!
  • Moderators
Posted (edited)

I don't remember who I stole this from :

Func _TCPGetIP($nSocket)
    Local $stcSockAddress = DllStructCreate('short;ushort;uint;char[8]')
    Local $aWS232DLL = DllCall('Ws2_32.dll', 'int', 'getpeername', 'int', $nSocket, _
        'ptr', DllStructGetPtr($stcSockAddress), 'int_ptr', DllStructGetSize($stcSockAddress))
    If @error = 0 And $aWS232DLL[0] = 0 Then
        $aWS232DLL = DllCall('Ws2_32.dll', 'str', 'inet_ntoa', 'int', DllStructGetData($stcSockAddress, 3))
        $stcSockAddress = 0
        If IsArray($aWS232DLL) Then Return $aWS232DLL[0]
    EndIf
    $stcSockAddress = 0
    Return SetError(1,  $stcSockAddress = 0, 0)
EndFunc

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Posted

Great, thanks smoke! worked like a charm.

~cdkid

AutoIt Console written in C#. Write au3 code right at the console :D_FileWriteToLineWrite to a specific line in a file.My UDF Libraries: MySQL UDF Library version 1.6 MySQL Database UDF's for AutoItI have stopped updating the MySQL thread above, all future updates will be on my SVN. The svn location is:kan2.sytes.net/publicsvn/mysqlnote: This will still be available, but due to my new job, and school hours, am no longer developing this udf.My business: www.hirethebrain.com Hire The Brain HireTheBrain.com Computer Consulting, Design, Assembly and RepairOh no! I've commited Scriptocide!

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...