Sign in to follow this  
Followers 0
DatMCEyeBall

Help improve this UDP server-less chat script

9 posts in this topic

#1 ·  Posted (edited)

This script is going to be part of a bigger project that I'm working on (HINT: It involves UDP).

The following code may/may not have bugs in it, I'm posting it because I need suggestions on how to improve it.

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GuiIPAddress.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <GuiListView.au3>
#include <Array.au3>

Local $ClientList[1][2] = [[-1, -1]]
UDPStartup()

$UserName = @ComputerName
$Form1 = GUICreate($UserName & " - ChAT TeST", 445, 200)

; GUI for sending and recieving messages
$Edit1 = GUICtrlCreateEdit("", 5, 5, 282, 161)
GUICtrlSetFont(-1, 7.5, Default, Default, "Lucida Console")
GUICtrlSetData(-1, "Chat Log:", "append")
GUICtrlSetState(-1, $GUI_DISABLE)
$Input1 = GUICtrlCreateInput("", 5, 169, 281, 21)
GUICtrlSendMsg(-1, 0x1500 + 1, False, 'Type here and press ENTER to send')
GUICtrlSetState(-1, $GUI_DISABLE)
$IPAddress3 = _GUICtrlIpAddress_Create($Form1, 290, 5, 130, 21)
_GUICtrlIpAddress_Set($IPAddress3, "0.0.0.0")
$Button1 = GUICtrlCreateButton("Add", 420, 5, 25, 21)
$hListview = GUICtrlCreateListView("#|IP", 290, 27, 155, 150)
_GUICtrlListView_SetColumnWidth($hListview, 0, 25)
_GUICtrlListView_SetColumnWidth($hListview, 1, 125)
$YOUR_IP_HERE = GUICtrlCreateInput(@IPAddress1, 300, 180, 130, 20, BitOR($SS_CENTERIMAGE, $SS_CENTER))
GUICtrlSetTip(-1, "Your IP")

; Bind to socket 80 - Used for recieving messages
Local $INsocket = UDPBind(@IPAddress1, 80)
If @error Then Exit 1111
; Bind to socket 81 - Used for recieving system messages
Local $SYSTEMsocket = UDPBind(@IPAddress1, 81)
If @error Then Exit 1112
; $fAllowSend flag prevents sending of a typed message when the edit is updated
Local $IP, $OUTsocket, $fAllowSend = True

; Register an Exit function that cleans up by closing all sockets used for sending to clients
OnAutoItExitRegister("Cleanup")

; Shows the GUI
GUISetState(@SW_SHOW)

; Timer is used to check every 25 ms for messages
$RecvTimer = TimerInit()
While 1
    $nMsg = GUIGetMsg()
    If $nMsg = $GUI_EVENT_CLOSE Then Exit
    If $nMsg = $YOUR_IP_HERE Then GUICtrlSetData($YOUR_IP_HERE, @IPAddress1)

    If $nMsg = $Input1 Then
        $Text = GUICtrlRead($Input1)
        If StringStripWS($Text, 8) <> "" And $fAllowSend = True Then
            ; Sends the message to all of the clients
            For $x = 0 To UBound($ClientList) - 1
                UDPSend($ClientList[$x][0], @IPAddress1 & "::" & $UserName & ": " & $Text)
            Next
            GUICtrlSetData($Edit1, @CRLF & $UserName & ":   " & $Text, "append")
            GUICtrlSetData($Input1, "")
        EndIf
    EndIf

    If $nMsg = $Button1 Then
        If $IP <> _GUICtrlIpAddress_Get($IPAddress3) And _GUICtrlIpAddress_Get($IPAddress3) <> @IPAddress1 And _GUICtrlIpAddress_Get($IPAddress3) <> "0.0.0.0" And Not _IsIPInList(_GUICtrlIpAddress_Get($IPAddress3)) Then
            $IP = _GUICtrlIpAddress_Get($IPAddress3)
            ; Sends a CR (Connection Request)
            $OUTsocket = UDPOpen($IP, 81)
            UDPSend($OUTsocket, "CR:" & @IPAddress1)

            $iSearch = -1
            For $x = 0 To UBound($ClientList) - 1
                If $ClientList[$x][0] <> -1 Then ContinueLoop
                If $ClientList[$x][0] = -1 Then
                    $iSearch = $x
                    ExitLoop
                EndIf
            Next
            If $iSearch = -1 Then
                $Bounds = UBound($ClientList)
                ReDim $ClientList[$Bounds + 1][2]
                $iSearch = $Bounds
            EndIf
            $ClientList[$iSearch][0] = UDPOpen($IP, 80)
            $ClientList[$iSearch][1] = $IP
            ConsoleWrite("Connected to: " & $IP & " @error = " & @error & @CRLF)

            $List = "CL"
            For $x = 0 To UBound($ClientList) - 1
                If $x = $iSearch Or $ClientList[$x][1] = @IPAddress1 Then ContinueLoop
                $List &= ":" & $ClientList[$x][1]
            Next
            If $List <> "CL" Then
                UDPSend($OUTsocket, $List)
            EndIf
            UDPCloseSocket($OUTsocket)

            ; Sends a Connection request to all of the clients with no re-send (CRR)
            For $x = 0 To UBound($ClientList) - 1
                If $x = $iSearch Then ContinueLoop
                $OUTsocket = UDPOpen($ClientList[$x][1], 81)
                UDPSend($OUTsocket, "CRR:" & $IP)
                UDPCloseSocket($OUTsocket)
            Next

            GUICtrlSetState($Edit1, $GUI_ENABLE)
            GUICtrlSetState($Input1, $GUI_ENABLE)
            _GUICtrlIpAddress_Set($IPAddress3, "0.0.0.0")
            _UpdateListView()
            If GUICtrlRead($Edit1) <> "Chat Log:" And MsgBox(4, "ChAt TeST", "Send Chat History to " & $IP & "?") = 6 Then
                $OUTsocket = UDPOpen($ClientList[$iSearch][1], 81)
                UDPSend($OUTsocket, "CH:" & @IPAddress1 & ":" & StringReplace(StringReplace(GUICtrlRead($Edit1), "/n", "//n"), @CRLF, "/n"))
                UDPCloseSocket($OUTsocket)
            EndIf
        EndIf
    EndIf

    If TimerDiff($RecvTimer) >= 25 Then
        $data = UDPRecv($INsocket, 1000000)
        If $data <> "" Then
            If IsBinary($data) Then $data = BinaryToString($data)
            If StringInStr($data, "::") Then
                ; Only recieve messages from clients in the list
                $Exp = StringRegExp($data, "([0-9.]{7,15})::(.*)", 1)
                If @error == 0 And UBound($Exp) == 2 And _IsIPInList($Exp[0]) Then
                    $fAllowSend = False
                    GUICtrlSetData($Edit1, @CRLF & $Exp[1], "append")
                    $fAllowSend = True
                EndIf
            EndIf
        EndIf

        $data = UDPRecv($SYSTEMsocket, 100000)
        If $data <> "" Then
            ConsoleWrite("Recieved: " & $data & @CRLF)

            $Exp = StringRegExp($data, "CR:([0-9.]{7,15})", 1)
            If @error = 0 Then
                $IP = $Exp[0]
                $iSearch = -1
                For $x = 0 To UBound($ClientList) - 1
                    If $ClientList[$x][0] <> -1 Then ContinueLoop
                    If $ClientList[$x][0] = -1 Then
                        $iSearch = $x
                        ExitLoop
                    EndIf
                Next
                If $iSearch = -1 Then
                    $Bounds = UBound($ClientList)
                    ReDim $ClientList[$Bounds + 1][2]
                    $iSearch = $Bounds
                EndIf
                $ClientList[$iSearch][0] = UDPOpen($IP, 80)
                $ClientList[$iSearch][1] = $IP
                ConsoleWrite("Connected to (CR): " & $IP & "    @error = " & @error & @CRLF)

                $List = "CL"
                For $x = 0 To UBound($ClientList) - 1
                    If $x = $iSearch Or $ClientList[$x][1] = @IPAddress1 Then ContinueLoop
                    $List &= ":" & $ClientList[$x][1]
                Next
                If $List <> "CL" Then
                    $OUTsocket = UDPOpen($ClientList[$iSearch][1], 81)
                    UDPSend($OUTsocket, $List)
                    UDPCloseSocket($OUTsocket)
                EndIf

                For $x = 0 To UBound($ClientList) - 1
                    If $x = $iSearch Then ContinueLoop
                    $OUTsocket = UDPOpen($ClientList[$x][1], 81)
                    UDPSend($OUTsocket, "CRR:" & $IP)
                    UDPCloseSocket($OUTsocket)
                Next

                GUICtrlSetState($Edit1, $GUI_ENABLE)
                GUICtrlSetState($Input1, $GUI_ENABLE)
                _UpdateListView()
                If GUICtrlRead($Edit1) <> "Chat Log:" And MsgBox(4, "ChAt TeST", "Send Chat History to " & $IP & "?") = 6 Then
                    $OUTsocket = UDPOpen($ClientList[$iSearch][1], 81)
                    UDPSend($OUTsocket, "CH:" & @IPAddress1 & ":" & StringReplace(StringReplace(GUICtrlRead($Edit1), "/n", "//n"), @CRLF, "/n"))
                    UDPCloseSocket($OUTsocket)
                EndIf
            EndIf

            $Exp = StringRegExp($data, "CL:(.*)", 1)
            If @error = 0 Then
                $List = StringSplit($Exp[0], ":")
                For $y = 1 To $List[0]
                    $IP = $List[$y]
                    $iSearch = -1
                    For $x = 0 To UBound($ClientList) - 1
                        If $ClientList[$x][0] <> -1 Then ContinueLoop
                        If $ClientList[$x][0] = -1 Then
                            $iSearch = $x
                            ExitLoop
                        EndIf
                    Next
                    If $iSearch = -1 Then
                        $Bounds = UBound($ClientList)
                        ReDim $ClientList[$Bounds + 1][2]
                        $iSearch = $Bounds
                    EndIf
                    $ClientList[$iSearch][0] = UDPOpen($IP, 80)
                    $ClientList[$iSearch][1] = $IP
                    ConsoleWrite("Connected to(CL): " & $IP & " @error = " & @error & @CRLF)
                    _UpdateListView()
                Next
            EndIf

            $Exp = StringRegExp($data, "CRR:([0-9.]{7,15})", 1)
            If @error = 0 Then
                $IP = $Exp[0]
                $iSearch = -1
                For $x = 0 To UBound($ClientList) - 1
                    If $ClientList[$x][0] <> -1 Then ContinueLoop
                    If $ClientList[$x][0] = -1 Then
                        $iSearch = $x
                        ExitLoop
                    EndIf
                Next
                If $iSearch = -1 Then
                    $Bounds = UBound($ClientList)
                    ReDim $ClientList[$Bounds + 1][2]
                    $iSearch = $Bounds
                EndIf
                $ClientList[$iSearch][0] = UDPOpen($IP, 80)
                $ClientList[$iSearch][1] = $IP
                ConsoleWrite("Connected to(CRR): " & $IP & "    @error = " & @error & @CRLF)

                GUICtrlSetState($Edit1, $GUI_ENABLE)
                GUICtrlSetState($Input1, $GUI_ENABLE)
                _UpdateListView()
            EndIf

            $Exp = StringRegExp($data, "DEL:([0-9.]{7,15})", 1)
            If @error = 0 Then
                $iSearch = _ArraySearch($ClientList, $Exp[0])
                If $iSearch <> -1 Then
                    UDPCloseSocket($ClientList[$iSearch][0])
                    _ArrayDelete($ClientList, $iSearch)
                    If Not IsArray($ClientList) Then
                        Local $ClientList[1][2]
                        $ClientList[0][0] = -1
                        $ClientList[0][1] = -1
                        GUICtrlSetData($Edit1, @CRLF & "Everyone has left you." & @CRLF & "Are you feeling lonely yet?" & @CRLF, "append")
                        GUICtrlSetState($Edit1, $GUI_DISABLE)
                        GUICtrlSetState($Input1, $GUI_DISABLE)
                    Else
                        GUICtrlSetData($Edit1, @CRLF & $Exp[0] & " left chat.", "append")
                    EndIf
                    _UpdateListView()
                EndIf
            EndIf

            $Exp = StringRegExp($data, "CH:([0-9.]{7,15}):(.*)", 1)
            If @error = 0 Then
                ConsoleWrite("Recieved(CH): " & $data & @CRLF)
                $fAllowSend = False
                GUICtrlSetData($Edit1, @CRLF & @CRLF & "Chat History From " & $Exp[0] & ":" & @CRLF & StringReplace(StringRegExpReplace($Exp[1], "([^/]/n)", @CRLF), "//n", "/n") & @CRLF, "append")
                $fAllowSend = True
            EndIf
        EndIf
        $RecvTimer = TimerInit()
    EndIf
WEnd

Func _UpdateListView()
    GUICtrlDelete($hListview)
    $hListview = GUICtrlCreateListView("#|IP", 290, 27, 155, 150)
    _GUICtrlListView_SetColumnWidth($hListview, 0, 25)
    _GUICtrlListView_SetColumnWidth($hListview, 1, 125)
    $IPList = ""
    For $x = 0 To UBound($ClientList) - 1
        If $ClientList[$x][1] = -1 Then ContinueLoop
        GUICtrlCreateListViewItem($x + 1 & "|" & $ClientList[$x][1], $hListview)
        $IPList = "|" & $ClientList[$x][1]
    Next
    $IPList = StringTrimLeft($IPList, 1)
EndFunc   ;==>_UpdateListView

Func _IsIPInList($sIP)
    $IPList = ""
    For $x = 0 To UBound($ClientList) - 1
        $IPList &= "|" & $ClientList[$x][1]
    Next
    $IPList = StringTrimLeft($IPList, 1)
    Return StringInStr($IPList, $sIP) > 0 ; True or False
EndFunc   ;==>_IsIPInList

Func Cleanup()
    GUIDelete()
    UDPCloseSocket($INsocket)
    UDPCloseSocket($SYSTEMsocket)
    If $OUTsocket Then UDPCloseSocket($OUTsocket)

    For $x = 0 To UBound($ClientList) - 1
        If $ClientList[$x][0] = -1 Then ContinueLoop

        $OUTsocket = UDPOpen($ClientList[$x][1], 81)
        UDPSend($OUTsocket, "DEL:" & @IPAddress1)
        UDPCloseSocket($OUTsocket)

        UDPCloseSocket($ClientList[$x][0])
        ConsoleWrite("Closed: " & $ClientList[$x][1] & ":80" & @CRLF)
    Next

    UDPShutdown()
EndFunc   ;==>Cleanup

Updates:

Various code improvements - by guiness

Edited by DatMCEyeBall

"Just be fred, all we gotta do, just be fred."  -Vocaliod

"That is a Hadouken. A KAMEHAMEHA would have taken him 13 days and 54 episodes to form." - Roden Hoxha

@tabhooked

Clock made of cursors ♣ Desktop Widgets ♣ Water Simulation

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

So you managed to test it on your system?

Edit: You can greatly reduce code e.g.

If StringInStr($IPList, $sIP) Then
    Return 1
Else
    Return 0
EndIf

; to...

Return StringInStr($IPList, $sIP) > 0 ; True or False

; or...

Return Int(StringInStr($IPList, $sIP) > 0); 1 or 0
Edited by guinness

_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 04/09/2015

Share this post


Link to post
Share on other sites

Some commenting will get you more replies, after all you are asking people to look through a fair bit of code. Why make it hard for them.

You may be right ;)

 

So you managed to test it on your system?

Edit: You can greatly reduce code e.g.

If StringInStr($IPList, $sIP) Then
    Return 1
Else
    Return 0
EndIf

; to...

Return StringInStr($IPList, $sIP) > 0 ; True or False

; or...

Return Int(StringInStr($IPList, $sIP) > 0); 1 or 0

Yep, tested it, works great just, you know working out the bugs

And reducing/commenting code.


"Just be fred, all we gotta do, just be fred."  -Vocaliod

"That is a Hadouken. A KAMEHAMEHA would have taken him 13 days and 54 episodes to form." - Roden Hoxha

@tabhooked

Clock made of cursors ♣ Desktop Widgets ♣ Water Simulation

Share this post


Link to post
Share on other sites

Well I honestly can't test it i.e. running on multiple networked computers, but I can look at the code at least


_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 04/09/2015

Share this post


Link to post
Share on other sites

@error == 0 ; == is for case-sensitive matching.

; Should be...

@error = 0


_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 04/09/2015

Share this post


Link to post
Share on other sites

tested on 4 vm's: XP, Vista, 7, 8.

result: XP not receiving anything, sending OK. also not receiving chat history. is there something to set in Windows firewall? there is no other firewall between vm's.

also: on all vm's, when asked to send chat history to new client, existing IP's are multiplied.

attached screenshot:

post-47848-0-37646200-1373317369_thumb.p

also: what's the line [10] DirRemove(@ScriptDir & "BackUp", 1) doing? a) you don't use the file anywhere else, and B) if this chat is part of a software about to be installed to Program Files, then most likely you will have a permission limitation on deleting stuff there.

Share this post


Link to post
Share on other sites

The BackUp folder is used by Tidy (by Jos) to back up the previous script before tidying. Probably best to remove this line from your code.


_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 04/09/2015

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

orbs,

I removed the DirRemove(@ScriptDir & "BackUp", 1) line

Also I tried to reproduce the bug you encountered and I got this:

28vaxpg.jpg

Using Oracle VirtualBox with 3 VMs (XP, XP, 7) and a "Real PC", it's probably your firewall - because windows likes to block incoming connections and not outgoing connections, and I have no firewall setup between any of my VMs.

guinness,

Thanks for the various code improvements.

Do you have any suggestions or other things to add to the script?

Edited by DatMCEyeBall

"Just be fred, all we gotta do, just be fred."  -Vocaliod

"That is a Hadouken. A KAMEHAMEHA would have taken him 13 days and 54 episodes to form." - Roden Hoxha

@tabhooked

Clock made of cursors ♣ Desktop Widgets ♣ Water Simulation

Share this post


Link to post
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
Sign in to follow this  
Followers 0