Klovis Posted July 14, 2011 Posted July 14, 2011 So I have this code and what I'm receiving is really big and it refreshes a lot so I need to send the data into a .txt file for review can someone please help me with this? PS I added a client so you can test this yourself Server expandcollapse popup#include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> Global $hGUI, $TCPAccept = 10, $TCPListen, $TCPPrevious = 255, $TCPRecv TCPStartup() $port = 5000 $TCPListen = TCPListen(@IPAddress1, $port) #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Server", 148, @DesktopHeight, 0, 0) $Label1 = GUICtrlCreateLabel("Server IP: ", 8, 8, 54, 17) $Label2 = GUICtrlCreateLabel("Connected Port:", 8, 40, 81, 17) $Label3 = GUICtrlCreateLabel("Recieved Data: ", 8, 72, 82, 17) $Label4 = GUICtrlCreateLabel("Label4", 8, 24, 132, 17) $Label5 = GUICtrlCreateLabel("Label5", 8, 56, 132, 17) $Label6 = GUICtrlCreateLabel("Waiting For Connections...", 8, 88, 132, @DesktopHeight) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### GUICtrlSetData($Label4, @IPAddress1) GUICtrlSetData($Label5, $port) Do $TCPAccept = TCPAccept($TCPListen) Until $TCPAccept <> -1 GUICtrlSetData($Label6, "Connection Open") While 1 $TCPRecv = TCPRecv($TCPAccept, 1000000) If $TCPRecv <> "" And $TCPRecv <> $TCPPrevious Then $TCPPrevious = $TCPRecv ConsoleWrite("What is recieved >> " & $TCPPrevious & @CRLF) If $TCPPrevious > $TCPPrevious +1 Then Do $TCPPrevious = $TCPPrevious + 1 Until $TCPPrevious = $TCPRecv EndIf If $TCPPrevious < $TCPPrevious -1 Then Do $TCPPrevious = $TCPPrevious - 1 Until $TCPPrevious = $TCPRecv EndIf GUICtrlSetData($Label6, $TCPRecv) EndIf $TCPRecv = TCPRecv($TCPAccept, 100) Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Client expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Global $IP TCPStartup() $Form1 = GUICreate("Client", 108, 23, 373, 441) $Input1 = GUICtrlCreateInput("0.0.0.0", 0, 0, 66, 21) $Button1 = GUICtrlCreateButton("Connect", 72, 0, 35, 21) GUISetState(@SW_SHOW) HotKeySet("{ENTER}", "DoButton") $i = 0 While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 If $i = 0 Then $i = 1 $IP = GUICtrlRead($Input1) $TCPConnect = TCPConnect($IP, 5000) GUICtrlSetData($Input1, "") GUICtrlSetData($Button1, "Send") EndIf If $i = 1 Then TCPSend($TCPConnect, GUICtrlRead($Input1)) GUICtrlSetData($Input1, "") EndIf EndSwitch WEnd Func DoButton() TCPSend($TCPConnect, GUICtrlRead($Input1)) GUICtrlSetData($Input1, "") EndFuncServer.au3clientinput.au3
JohnOne Posted July 14, 2011 Posted July 14, 2011 Would you not just replace this line ConsoleWrite("What is recieved >> " & $TCPPrevious & @CRLF) with a filewrite($hfile,... etc... line? AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
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