HeavenlyDemon Posted April 24, 2011 Share Posted April 24, 2011 How can i combine the TCPSend and TCPRecv from the AutoIT Help File to have only 1 GUI, 1 edibox, 1 input box expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Forum = GUICreate("LogIn", 317, 195, 192, 124) $Input = GUICtrlCreateInput("", 64, 24, 185, 21) $Button = GUICtrlCreateButton("LogIn", 96, 56, 113, 25) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $Msg = GUIGetMsg() Switch $Msg Case $GUI_EVENT_CLOSE Exit Case $Button $User = GUICtrlRead($Input) GUIDelete() Call("comuni") EndSwitch WEnd Func comuni() #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 615, 438, 192, 124) $Edit1 = GUICtrlCreateEdit("", 24, 24, 561, 265, BitOR($GUI_SS_DEFAULT_EDIT, $ES_READONLY)) $Input1 = GUICtrlCreateInput("", 24, 296, 561, 21) $Button1 = GUICtrlCreateButton("Button1", 24, 320, 113, 25) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### $IP = FileRead(@WorkingDir & "\ListIP.cfg") $port = 33891 TCPStartup() $MS = TCPListen($IP, $port) If $MS = -1 Then MsgBox(0, "Error", "Connection Error : " & $IP & @CR & @CR & "Error : " & @error) Else MsgBox(0, "OK", "Connected") EndIf $CS = -1 Do $CS = TCPAccept($MS) Until $CS <> -1 While 1 $ret = TCPRecv($CS, 2048) If @error Then MsgBox(0, "Error", "Error") Else MsgBox(0, "OK", "ALL OK") EndIf If $ret <> "" Then GUICtrlSetData($Edit1, $User & " >" & $ret & @CRLF & GUICtrlRead($Edit1)) WEnd While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 $zCS = TCPConnect($IP, $port) If @error Then MsgBox(0, "Error", "Connection Error : " & @error) Else While 1 $data = GUICtrlRead($Input1) If @error Or $data = "" Then ExitLoop TCPSend($zCS, $data) If @error Then ExitLoop WEnd EndIf EndSwitch WEnd EndFunc ;==>comuni this is one of the many things i have tried Link to comment Share on other sites More sharing options...
PsaltyDS Posted April 24, 2011 Share Posted April 24, 2011 Typically, separate processes provide the server and the client connecting to it (and typically on separate machines). Your While/WEnd loop for TCPRecv() has no exit. And so you never get to the TCPSend(). Why bother having the script talk to itself over TCP in the first place? Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
HeavenlyDemon Posted April 25, 2011 Author Share Posted April 25, 2011 (edited) i dont want to have 2 separate windows 1 for send and 1 for recive as for my ideea i want to create a masive conferice window Edited April 25, 2011 by HeavenlyDemon Link to comment Share on other sites More sharing options...
PsaltyDS Posted April 25, 2011 Share Posted April 25, 2011 I get it, but AutoIt is single-threaded and handling full duplex asynchronous connections in a single script, in a single process, with a single thread, is going to be painful. An option is to have the script spawn a child process of itself that communicates with the parent process, so only the parent process handles GUI functions. So the original instance would generate the GUI, then spawn child instances for individual async I/O tasks which communicate back to the parent for the GUI. Somewhere along the road to implementing that, I think you are going to decide that an interpreted scripting language like AutoIt is not the right choice for this project. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
HeavenlyDemon Posted April 25, 2011 Author Share Posted April 25, 2011 (edited) i am going to give it a try any way 10x for help Edited April 25, 2011 by HeavenlyDemon Link to comment Share on other sites More sharing options...
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