Rob99 Posted November 26, 2020 Posted November 26, 2020 hi friends I'm new to this fabulous community, I ask you for a help to understand how I can redirect the standard output of a netcat, let me explain better: I have a network application that sends me a stream of data I would like to take them and put them in a listbox updating them dynamically, I noticed that autoit is not multithreading , so I thought of having NetCat do the data reception and if it was possible to redirect the result to a listview, do you think it makes sense or are there better solutions like UDF? I have personally searched but I have not found anything that did for me, below the draft I wrote expandcollapse popup#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <TabConstants.au3> #include <WindowsConstants.au3> ; End Initialization #Region ### START Koda GUI section ### $MainForm = GUICreate("Terminal", 303, 144, 344, 260) $NRShellStart = GUICtrlCreateButton("Start", 12, 29, 129, 65) GUICtrlSetFont(-1, 8, 400, 0, "Arial") $NRShellStop = GUICtrlCreateButton("Stop", 148, 29, 131, 65) GUICtrlSetFont(-1, 8, 400, 0, "Arial") GUICtrlCreateTabItem("") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch Select Case $nMsg = $NRShellStart ;ShellExecute( @ScriptDir & "\nc64.exe", "-lvp 23456", "c:\") Local $text Local $Pid = Run( @ScriptDir & "\nc64.exe -lvp 23456", "", 2 + 4) $text &= StdoutRead($Pid, False, False) ConsoleWrite($text & @CRLF) Case $nMsg = $NRShellStop ProcessClose("nc64.exe") EndSelect WEnd thanks in advance to all those who want to answer by Rob99
Nine Posted November 26, 2020 Posted November 26, 2020 (edited) your run statement skips the show flag, see help file, that is why it doesn't work. And the way you capture $text may not be enough to grab all data, usually it should be embedded in a loop. And there is no reason why you have a switch and a select, you can combine those 2 into a single switch. Edited November 26, 2020 by Nine Rob99 1 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Multi-Threading Made Easy
Rob99 Posted November 27, 2020 Author Posted November 27, 2020 @Nine thanks I will study what you told me🙂
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