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.
AutoIt
#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <GuiIPAddress.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <GuiListView.au3> #include <Array.au3> $ClientList[$x][$y] = -1 $YOUR_IP_HERE = GUICtrlCreateInput(@IPAddress1, 300, 180, 130, 20, BitOR($SS_CENTERIMAGE, $SS_CENTER)) Local $INsocket = UDPBind(@IPAddress1, 80), $SYSTEMsocket = UDPBind(@IPAddress1, 81), $IP, $OUTsocket, $fAllowSend = True While 1 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 $iSearch = -1 $iSearch = $x $iSearch = $Bounds $ClientList[$iSearch][1] = $IP $List = "CL" $List &= ":" & $ClientList[$x][1] _UpdateListView() $IP = $Exp[0] $iSearch = -1 $iSearch = $x $iSearch = $Bounds $ClientList[$iSearch][1] = $IP $List = "CL" $List &= ":" & $ClientList[$x][1] _UpdateListView() If GUICtrlRead($Edit1) <> "Chat Log:" And MsgBox(4, "ChAt TeST", "Send Chat History to " & $IP & "?") = 6 Then UDPSend($OUTsocket, "CH:" & @IPAddress1 & ":" & StringReplace(StringReplace(GUICtrlRead($Edit1), "/n", "//n"), @CRLF, "/n")) $IP = $List[$y] $iSearch = -1 $iSearch = $x $iSearch = $Bounds $ClientList[$iSearch][1] = $IP _UpdateListView() $IP = $Exp[0] $iSearch = -1 $iSearch = $x $iSearch = $Bounds $ClientList[$iSearch][1] = $IP _UpdateListView() $ClientList[0][0] = -1 $ClientList[0][1] = -1 GUICtrlSetData($Edit1, @CRLF & "Everyone has left you." & @CRLF & "Are you feeling lonely yet?" & @CRLF, "append") _UpdateListView() GUICtrlSetData($Edit1, @CRLF & @CRLF & "Chat History From " & $Exp[0] & ":" & @CRLF & StringReplace(StringRegExpReplace($Exp[1], "([^/]/n)", @CRLF), "//n", "/n") & @CRLF, "append") $IPList = "" $IPList = "|" & $ClientList[$x][1] EndFunc ;==>_UpdateListView $IPList = "" $IPList &= "|" & $ClientList[$x][1] Return 1 Return 0 EndFunc ;==>_IsIPInList EndFunc ;==>Cleanup