Jump to content

User defined variable


randy2631
 Share

Recommended Posts

I am working on a project for class and have come to the end of my short rope. Ive only been using AutoIT for about a month so its pretty new to me.

I cant figure out how to set a users input as a variable. Im working on a network diagnostic tool and im using an input box to get the IP in order to ping a remote computer as well as to show the route to that computer. the trouble is on the remote port scan, it asks you for the IP every time. it took me a few hours but i realized it asked every time because that is what i told it to do. If the IP from the input box was stored as a variable then i think it would work. Im gonna try and post the code but since this is my first post i cant promise it will work.

#include <GuiMenu.au3>
#include <GuiConstantsEx.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>
#include <GuiConstants.au3>
#include <Constants.au3>
#include <TCP.au3>
#include <EditConstants.au3>
#include <StaticConstants.au3>

Opt('MustDeclareVars', 1)

Global $Memo, $IPAddr, $Input
Global Enum $New = 1000, $Open, $Save, $Exit, _
        $Cut, $Copy, $Paste, $About, $Ping, $RemScan, $RtPrint

_Main()

Func _Main()

    Local $GUI, $File, $Edit, $Help, $Main, $msg
    $msg = 0
    ; Create GUI
    $GUI = GUICreate("Menu", 600, 400)
    ; Create File menu
    $File = _GUICtrlMenu_CreateMenu()
    _GUICtrlMenu_InsertMenuItem($File, 0, "&Ping", $Ping)
    _GUICtrlMenu_InsertMenuItem($File, 0, "&Route Print", $RtPrint)
    _GUICtrlMenu_InsertMenuItem($File, 0, "&Remote Port Scan", $RemScan)
    ; Create Edit menu
    $Edit = _GUICtrlMenu_CreateMenu()
    ; Create Help menu
    $Help = _GUICtrlMenu_CreateMenu()
    ; Create Main menu
    $Main = _GUICtrlMenu_CreateMenu()
    _GUICtrlMenu_InsertMenuItem($Main, 0, "&System", 0, $File)
    _GUICtrlMenu_InsertMenuItem($Main, 1, "&Hard Drives", 0, $Edit)
    _GUICtrlMenu_InsertMenuItem($Main, 2, "&Memory", 0, $Help)
    ; Set window menu
    _GUICtrlMenu_SetMenu($GUI, $Main)
    $Memo = GUICtrlCreateEdit("" & @CRLF, 2, 2, 600, 400, $ES_AUTOVSCROLL + $WS_VSCROLL)
    GUICtrlSetFont($Memo, 9, 400, 0, "Courier New")

    GUISetState()
    ; Loop until user exits
    GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc   ;==>_Main


Func WM_COMMAND($Wnd, $Msg, $iwParam, $ilParam)
    $IPAddr = InputBox("Remote IP Address", "IP Address:", "")
    Switch _WinAPI_LoWord($iwParam)
        Case $Ping
            MemoWrite("Collecting Ping information")
            Local $hostdata = Run(@ComSpec & " /c ping" & " " & $Input, @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
            Local $line1
            While 1
                $line1 = StdoutRead($hostdata)
                If @error Then ExitLoop
                If $line1 <> "" Then
                    MemoWrite("Ping: " & $line1)
                EndIf
            WEnd
            While 1
                $line1 = StderrRead($hostdata)
                If @error Then ExitLoop

            WEnd
            MemoWrite("Ping command complete")

        Case $RtPrint
            MemoWrite("Route Print")
            Local $hostdata = Run(@ComSpec & " /c route print", @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
            Local $line1
            While 1
                $line1 = StdoutRead($hostdata)
                If @error Then ExitLoop
                If $line1 <> "" Then
                    MemoWrite("Route Print: " & $line1)
                EndIf
            WEnd
            While 1
                $line1 = StderrRead($hostdata)
                If @error Then ExitLoop
            WEnd
            MemoWrite("Route Print command complete")

        Case $RemScan
            MemoWrite("Remote Port Scan")
            Local $socket, $recdata, $Client, $i
            While $i < 1024
                $i = $i + 1
                MemoWrite("Trying to connect to port " & ":" & $i)
                $Client = _TCP_Client_Create($Input, $i)
                Sleep(1000)
                _TCP_RegisterEvent($Client, $TCP_RECEIVE, "Received"); Function "Received" will get called when something is received
                _TCP_RegisterEvent($Client, $TCP_CONNECT, "Connected"); And func "Connected" will get called when the client is connected.
                _TCP_RegisterEvent($Client, $TCP_DISCONNECT, "Disconnected"); And "Disconnected" will get called when the server disconnects us, or when the connection is lost.
                _TCP_Client_Stop($socket)
            WEnd
            MemoWrite("Port scan for 1-1024 on " & $Input & " is complete.")

        Case $Save
            MemoWrite("Save")
        Case $Exit
            Exit
        Case $Cut
            MemoWrite("Cut")
        Case $Copy
            MemoWrite("Copy")
        Case $Paste
            MemoWrite("Paste")
        Case $About
            MemoWrite("About")
    EndSwitch
    Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_COMMAND

; Write message to memo
Func MemoWrite($Message)
    GUICtrlSetData($Memo, $Message & @CRLF, 1)
EndFunc   ;==>MemoWrite



Func Connected($socket, $Error); We registered this (you see?), When we're connected (or not) this function will be called.
    Local $i
    If Not $Error Then; If there is no error...
        MemoWrite("CLIENT: Connected!" & " Port: " & $i); ... we're connected.
    Else; ,else...
        MemoWrite("CLIENT: Could not connect to port:" & $i & " Error:" & $Error); ... we aren't.
    EndIf

EndFunc   ;==>Connected

Func Received($socket, $Received, $Error); And we also registered this! Our homemade do-it-yourself function gets called when something is received.
    MemoWrite("CLIENT: We received this: " & $Received); (and we'll display it)

EndFunc   ;==>Received

Func Disconnected($socket, $Error); Our disconnect function. Notice that all functions should have an $iError parameter.
    Local $i
    MemoWrite("CLIENT: Connection closed or lost. " & ":" & $i & " Error:" & $Error)
EndFunc   ;==>Disconnected
Edited by randy2631
Link to comment
Share on other sites

This is my version:

#include <GuiMenu.au3>
#include <GuiConstantsEx.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>
#include <GuiConstants.au3>
#include <Constants.au3>
#include <EditConstants.au3>
#include <StaticConstants.au3>

Opt('MustDeclareVars', 1)

Global $Memo, $IPAddr, $Input
Global Enum $New = 1000, $Open, $Save, $Exit, _
        $Cut, $Copy, $Paste, $About, $Ping, $RemScan, $RtPrint

_Main()

Func _Main()

    Local $GUI, $File, $Edit, $Help, $Main, $msg
    $msg = 0
    ; Create GUI
    $GUI = GUICreate("Menu", 600, 400)
    ; Create File menu
    $File = _GUICtrlMenu_CreateMenu()
    _GUICtrlMenu_InsertMenuItem($File, 0, "&Ping", $Ping)
    _GUICtrlMenu_InsertMenuItem($File, 0, "&Route Print", $RtPrint)
    _GUICtrlMenu_InsertMenuItem($File, 0, "&Remote Port Scan", $RemScan)
    ; Create Edit menu
    $Edit = _GUICtrlMenu_CreateMenu()
    ; Create Help menu
    $Help = _GUICtrlMenu_CreateMenu()
    ; Create Main menu
    $Main = _GUICtrlMenu_CreateMenu()
    _GUICtrlMenu_InsertMenuItem($Main, 0, "&System", 0, $File)
    _GUICtrlMenu_InsertMenuItem($Main, 1, "&Hard Drives", 0, $Edit)
    _GUICtrlMenu_InsertMenuItem($Main, 2, "&Memory", 0, $Help)
    ; Set window menu
    _GUICtrlMenu_SetMenu($GUI, $Main)
    $Memo = GUICtrlCreateEdit("" & @CRLF, 2, 2, 600, 400, $ES_AUTOVSCROLL + $WS_VSCROLL)
    GUICtrlSetFont($Memo, 9, 400, 0, "Courier New")

    GUISetState()
    ; Loop until user exits
    $IPAddr = InputBox("Remote IP Address", "IP Address:", "")
    GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc   ;==>_Main


Func WM_COMMAND($Wnd, $Msg, $iwParam, $ilParam)
    Switch _WinAPI_LoWord($iwParam)
        Case $Ping
            MemoWrite("Collecting Ping information")
            Local $hostdata = Run(@ComSpec & " /c ping" & " " & $Input, @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
            Local $line1
            While 1
                $line1 = StdoutRead($hostdata)
                If @error Then ExitLoop
                If $line1 <> "" Then
                    MemoWrite("Ping: " & $line1)
                EndIf
            WEnd
            While 1
                $line1 = StderrRead($hostdata)
                If @error Then ExitLoop

            WEnd
            MemoWrite("Ping command complete")

        Case $RtPrint
            MemoWrite("Route Print")
            Local $hostdata = Run(@ComSpec & " /c route print", @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
            Local $line1
            While 1
                $line1 = StdoutRead($hostdata)
                If @error Then ExitLoop
                If $line1 <> "" Then
                    MemoWrite("Route Print: " & $line1)
                EndIf
            WEnd
            While 1
                $line1 = StderrRead($hostdata)
                If @error Then ExitLoop
            WEnd
            MemoWrite("Route Print command complete")

        Case $RemScan
            MemoWrite("Remote Port Scan")
            Local $socket, $recdata, $Client, $i
            While $i < 1024
                $i = $i + 1
                MemoWrite("Trying to connect to port " & ":" & $i)
                $Client = _TCP_Client_Create($Input, $i)
                Sleep(1000)
                _TCP_RegisterEvent($Client, $TCP_RECEIVE, "Received"); Function "Received" will get called when something is received
                _TCP_RegisterEvent($Client, $TCP_CONNECT, "Connected"); And func "Connected" will get called when the client is connected.
                _TCP_RegisterEvent($Client, $TCP_DISCONNECT, "Disconnected"); And "Disconnected" will get called when the server disconnects us, or when the connection is lost.
                _TCP_Client_Stop($socket)
            WEnd
            MemoWrite("Port scan for 1-1024 on " & $Input & " is complete.")

        Case $Save
            MemoWrite("Save")
        Case $Exit
            Exit
        Case $Cut
            MemoWrite("Cut")
        Case $Copy
            MemoWrite("Copy")
        Case $Paste
            MemoWrite("Paste")
        Case $About
            MemoWrite("About")
    EndSwitch
    Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_COMMAND

; Write message to memo
Func MemoWrite($Message)
    GUICtrlSetData($Memo, $Message & @CRLF, 1)
EndFunc   ;==>MemoWrite



Func Connected($socket, $Error); We registered this (you see?), When we're connected (or not) this function will be called.
    Local $i
    If Not $Error Then; If there is no error...
        MemoWrite("CLIENT: Connected!" & " Port: " & $i); ... we're connected.
    Else; ,else...
        MemoWrite("CLIENT: Could not connect to port:" & $i & " Error:" & $Error); ... we aren't.
    EndIf

EndFunc   ;==>Connected

Func Received($socket, $Received, $Error); And we also registered this! Our homemade do-it-yourself function gets called when something is received.
    MemoWrite("CLIENT: We received this: " & $Received); (and we'll display it)

EndFunc   ;==>Received

Func Disconnected($socket, $Error); Our disconnect function. Notice that all functions should have an $iError parameter.
    Local $i
    MemoWrite("CLIENT: Connection closed or lost. " & ":" & $i & " Error:" & $Error)
EndFunc   ;==>Disconnected

I removed the

#include <TCP.au3>
and move this:
$IPAddr = InputBox("Remote IP Address", "IP Address:", "")
up.

It asks you continuously because you put it in the looping command, so I just pull it up, and let the others be looped.

One more thing, is it because of your TCP.au3 or is it a bug?

After I entered the IP Address, then I pressed System > Remote Port Scan, there is a error:

>"C:\Program Files\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Documents and Settings\Administrator\Desktop\New AutoIt v3 Script.au3"

C:\Documents and Settings\Administrator\Desktop\New AutoIt v3 Script.au3 (95) : ==> Unknown function name.:

$Client = _TCP_Client_Create($Input, $i)

$Client = ^ ERROR

>Exit code: 1 Time: 105.692

I really admire your work, being able to create such scripts, only using AutoIt for a month...

So tell me if I am helping you or not :D

JPGRARMouse Lock | My website | Thanks so much for your help! ❤️

Link to comment
Share on other sites

Thank you for all your replies. I didnt mean to mislead anyone, but i didnt do this myself. its a class project that we are working on.

TCP.au3 is another set of functions i got from the forums. i attached it so you can have it.

Thank you Crash! i used the code you posted and added the TCP.au3 back in and it works. youre awesome

TCP.au3

Link to comment
Share on other sites

Thank you for all your replies. I didnt mean to mislead anyone, but i didnt do this myself. its a class project that we are working on.

TCP.au3 is another set of functions i got from the forums. i attached it so you can have it.

Thank you Crash! i used the code you posted and added the TCP.au3 back in and it works. youre awesome

You're most welcome! Well, I'm not awesome... because I'm also a beginner! I am kind of surprised that despite only using AutoIt for only a few months, you and your friends (or you yourself) are able to produce such complex yet powerful program... :D

Well, good luck then! :D

$$$$$$$$$$$$$$$$$$$$ WAIT!!! $$$$$$$$$$$$$$$$$$

That's not the end yet. Personally, I think it will be more user friendly if you add more messages to the user, you know, something like step-by-step; say after the user enter the IP address, the program will tell them what to do next to test their connections.

Please consider my humble opinion. :D

Edited by Crash

JPGRARMouse Lock | My website | Thanks so much for your help! ❤️

Link to comment
Share on other sites

The error comes because you dont have the function

_TCP_Client_Create

_TCP_RegisterEvent

_TCP_Client_Stop

True! Thanks, but I've figured that out when I switched off my computer! :D

By the way, your footer message has an error:

mfg. Simon

Many of my answers are translated of google, because I'am from Germany

The I'am should be I'm. Thanks. :D

Edited by Crash

JPGRARMouse Lock | My website | Thanks so much for your help! ❤️

Link to comment
Share on other sites

Hey Crash i recreated the GUI and added a little to it. I havent added any new functions but this is definetly an improvement. Im not 100% sure the port scan function is working but it looks like it is

#include <GuiIPAddress.au3>
#include <GuiMenu.au3>
#include <GuiConstantsEx.au3>
#include <GuiConstants.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>
#include <TCP.au3>
#include <EditConstants.au3>
#include <StaticConstants.au3>



Opt('MustDeclareVars', 1)

Global $Ping, $RoutePrint, $RemotePort, $IPAddress, $Memo

_Main()

Func _Main()

Local $Tool, $System, $HardDrive, $Memory

$Tool = GUICreate("Tool Box", 600, 400, 192, 124)
$System = GUICtrlCreateMenu("System")
$Ping = GUICtrlCreateMenuItem("Ping", $System)
$RoutePrint = GUICtrlCreateMenuItem("Route Print", $System)
$RemotePort = GUICtrlCreateMenuItem("Remote Port Scan", $System)
$HardDrive = GUICtrlCreateMenu("Hard Drive")
$Memory = GUICtrlCreateMenu("Memory")
$IPAddress = _GUICtrlIpAddress_Create($Tool, 40, 0, 321, 33)
_GUICtrlIpAddress_Set($IPAddress, "0.0.0.0")


$Memo = GUICtrlCreateEdit("" & @CRLF, 1, 40, 600, 340, $ES_AUTOVSCROLL + $WS_VSCROLL + $ES_AUTOHSCROLL)
    GUICtrlSetFont($Memo, 9, 400, 0, "Courier New")

GUISetState()
    ; Loop until user exits
    GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc   ;==>_Main




Func WM_COMMAND($Wnd, $Msg, $iwParam, $ilParam)

    Switch _WinAPI_LoWord($iwParam)
        Case $Ping
            MemoWrite("Collecting Ping information")
            Local $hostdata = Run(@ComSpec & " /c ping" & " " & _GUICtrlIpAddress_Get($IPAddress), @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
            Local $line1
            While 1
                $line1 = StdoutRead($hostdata)
                If @error Then ExitLoop
                If $line1 <> "" Then
                    MemoWrite("Ping: " & $line1)
                EndIf
            WEnd
            While 1
                $line1 = StderrRead($hostdata)
                If @error Then ExitLoop

            WEnd
            MemoWrite("Ping command complete")

        Case $RoutePrint
            MemoWrite("Route Print")
            Local $hostdata = Run(@ComSpec & " /c route print", @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
            Local $line1
            While 1
                $line1 = StdoutRead($hostdata)
                If @error Then ExitLoop
                If $line1 <> "" Then
                    MemoWrite("Route Print: " & $line1)
                EndIf
            WEnd
            While 1
                $line1 = StderrRead($hostdata)
                If @error Then ExitLoop
            WEnd
            MemoWrite("Route Print command complete")

        Case $RemotePort
            MemoWrite("Remote Port Scan")
            Local $socket, $recdata, $Client, $i
            While $i < 1024
                $i = $i + 1
                MemoWrite("Trying to connect to port " & ":" & $i)
                $Client = _TCP_Client_Create(_GUICtrlIpAddress_Get($IPAddress), $i)
                Sleep(1000)
                _TCP_RegisterEvent($Client, $TCP_RECEIVE, "Received"); Function "Received" will get called when something is received
                _TCP_RegisterEvent($Client, $TCP_CONNECT, "Connected"); And func "Connected" will get called when the client is connected.
                _TCP_RegisterEvent($Client, $TCP_DISCONNECT, "Disconnected"); And "Disconnected" will get called when the server disconnects us, or when the connection is lost.
                _TCP_Client_Stop($socket)
            WEnd
            MemoWrite("Port scan for 1-1024 on " & _GUICtrlIpAddress_Get($IPAddress) & " is complete.")

    EndSwitch
    Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_COMMAND









; Write message to memo
Func MemoWrite($Message)
    GUICtrlSetData($Memo, $Message & @CRLF, 1)
EndFunc   ;==>MemoWrite










Func Connected($socket, $Error); We registered this (you see?), When we're connected (or not) this function will be called.
    Local $i
    If Not $Error Then; If there is no error...
        MemoWrite("CLIENT: Connected!" & " Port: " & $i); ... we're connected.
    Else; ,else...
        MemoWrite("CLIENT: Could not connect to port:" & $i & " Error:" & $Error); ... we aren't.
    EndIf

EndFunc   ;==>Connected

Func Received($socket, $Received, $Error); And we also registered this! Our homemade do-it-yourself function gets called when something is received.
    MemoWrite("CLIENT: We received this: " & $Received); (and we'll display it)

EndFunc   ;==>Received

Func Disconnected($socket, $Error); Our disconnect function. Notice that all functions should have an $iError parameter.
    Local $i
    MemoWrite("CLIENT: Connection closed or lost. " & ":" & $i & " Error:" & $Error)
EndFunc   ;==>Disconnected
Link to comment
Share on other sites

Hey Crash i recreated the GUI and added a little to it. I havent added any new functions but this is definetly an improvement. Im not 100% sure the port scan function is working but it looks like it is

#include <GuiIPAddress.au3>
#include <GuiMenu.au3>
#include <GuiConstantsEx.au3>
#include <GuiConstants.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>
#include <TCP.au3>
#include <EditConstants.au3>
#include <StaticConstants.au3>



Opt('MustDeclareVars', 1)

Global $Ping, $RoutePrint, $RemotePort, $IPAddress, $Memo

_Main()

Func _Main()

Local $Tool, $System, $HardDrive, $Memory

$Tool = GUICreate("Tool Box", 600, 400, 192, 124)
$System = GUICtrlCreateMenu("System")
$Ping = GUICtrlCreateMenuItem("Ping", $System)
$RoutePrint = GUICtrlCreateMenuItem("Route Print", $System)
$RemotePort = GUICtrlCreateMenuItem("Remote Port Scan", $System)
$HardDrive = GUICtrlCreateMenu("Hard Drive")
$Memory = GUICtrlCreateMenu("Memory")
$IPAddress = _GUICtrlIpAddress_Create($Tool, 40, 0, 321, 33)
_GUICtrlIpAddress_Set($IPAddress, "0.0.0.0")


$Memo = GUICtrlCreateEdit("" & @CRLF, 1, 40, 600, 340, $ES_AUTOVSCROLL + $WS_VSCROLL + $ES_AUTOHSCROLL)
    GUICtrlSetFont($Memo, 9, 400, 0, "Courier New")

GUISetState()
    ; Loop until user exits
    GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc   ;==>_Main




Func WM_COMMAND($Wnd, $Msg, $iwParam, $ilParam)

    Switch _WinAPI_LoWord($iwParam)
        Case $Ping
            MemoWrite("Collecting Ping information")
            Local $hostdata = Run(@ComSpec & " /c ping" & " " & _GUICtrlIpAddress_Get($IPAddress), @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
            Local $line1
            While 1
                $line1 = StdoutRead($hostdata)
                If @error Then ExitLoop
                If $line1 <> "" Then
                    MemoWrite("Ping: " & $line1)
                EndIf
            WEnd
            While 1
                $line1 = StderrRead($hostdata)
                If @error Then ExitLoop

            WEnd
            MemoWrite("Ping command complete")

        Case $RoutePrint
            MemoWrite("Route Print")
            Local $hostdata = Run(@ComSpec & " /c route print", @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
            Local $line1
            While 1
                $line1 = StdoutRead($hostdata)
                If @error Then ExitLoop
                If $line1 <> "" Then
                    MemoWrite("Route Print: " & $line1)
                EndIf
            WEnd
            While 1
                $line1 = StderrRead($hostdata)
                If @error Then ExitLoop
            WEnd
            MemoWrite("Route Print command complete")

        Case $RemotePort
            MemoWrite("Remote Port Scan")
            Local $socket, $recdata, $Client, $i
            While $i < 1024
                $i = $i + 1
                MemoWrite("Trying to connect to port " & ":" & $i)
                $Client = _TCP_Client_Create(_GUICtrlIpAddress_Get($IPAddress), $i)
                Sleep(1000)
                _TCP_RegisterEvent($Client, $TCP_RECEIVE, "Received"); Function "Received" will get called when something is received
                _TCP_RegisterEvent($Client, $TCP_CONNECT, "Connected"); And func "Connected" will get called when the client is connected.
                _TCP_RegisterEvent($Client, $TCP_DISCONNECT, "Disconnected"); And "Disconnected" will get called when the server disconnects us, or when the connection is lost.
                _TCP_Client_Stop($socket)
            WEnd
            MemoWrite("Port scan for 1-1024 on " & _GUICtrlIpAddress_Get($IPAddress) & " is complete.")

    EndSwitch
    Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_COMMAND









; Write message to memo
Func MemoWrite($Message)
    GUICtrlSetData($Memo, $Message & @CRLF, 1)
EndFunc   ;==>MemoWrite










Func Connected($socket, $Error); We registered this (you see?), When we're connected (or not) this function will be called.
    Local $i
    If Not $Error Then; If there is no error...
        MemoWrite("CLIENT: Connected!" & " Port: " & $i); ... we're connected.
    Else; ,else...
        MemoWrite("CLIENT: Could not connect to port:" & $i & " Error:" & $Error); ... we aren't.
    EndIf

EndFunc   ;==>Connected

Func Received($socket, $Received, $Error); And we also registered this! Our homemade do-it-yourself function gets called when something is received.
    MemoWrite("CLIENT: We received this: " & $Received); (and we'll display it)

EndFunc   ;==>Received

Func Disconnected($socket, $Error); Our disconnect function. Notice that all functions should have an $iError parameter.
    Local $i
    MemoWrite("CLIENT: Connection closed or lost. " & ":" & $i & " Error:" & $Error)
EndFunc   ;==>Disconnected

Congrats, nice GUI you have there! :)

As for the port scan function, sorry I don't have the time to go through your scripts again -- I'm having the government test soon, and I will not be online -- When I tried it, the scripts go on and on:

Trying to connect to port: 1

Trying to connect to port: 2

Trying to connect to port: 3

Trying to connect to port: 4

Trying to connect to port: 5

Trying to connect to port: 6

Trying to connect to port: 7

Trying to connect to port: 8

Trying to connect to port: 9

Trying to connect to port: 10

Trying to connect to port: 11

Trying to connect to port: 12

...and so on...

But some with:

CLIENT: Could not connect to port: Error:10060

So anyway, sorry I could not be any help. I really have to study. Bye~ until my exam is over. :)

Edited by Crash

JPGRARMouse Lock | My website | Thanks so much for your help! ❤️

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

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