Klovis Posted June 26, 2011 Share Posted June 26, 2011 So when I open up the server then the client if I move the slider it will be 49 or 51 depending on which way I go, but then It'll stop right there and stop reading the info. Can someone point me in the right direction? Server #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> TCPStartup() $TCPListen = TCPListen(@IPAddress1, 1000) $Form1 = GUICreate("Server", 30, 14,@DesktopWidth - 31,0,$WS_POPUP) $Label1 = GUICtrlCreateLabel("", 0, 0, 30, 17) GUISetState(@SW_SHOW) Do Do $TCPAccept = TCPAccept($TCPListen) Until $TCPAccept <> -1 Do $TCPRecv = TCPRecv($TCPAccept, 255) Until $TCPRecv <> "" If $TCPRecv <> "" Then GUICtrlRead($TCPRecv) GUICtrlSetData($Label1, $TCPRecv) GUICtrlSetData($TCPAccept, -1) GUICtrlSetData($TCPRecv, "") EndIf Until $GUI_EVENT_CLOSE While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Client #include <GUIConstantsEx.au3> #include <SliderConstants.au3> #include <WindowsConstants.au3> TCPStartup() $TCPConnect = TCPConnect(@IPAddress1, 1000) If $TCPConnect = -1 Then Exit $Form1 = GUICreate("Client", 152, 48, 192, 114) $Slider1 = GUICtrlCreateSlider(0, 0, 150, 45) GUICtrlSetLimit(-1, 100, 0) GUICtrlSetData($Slider1, 50) $hSlider = GUICtrlGetHandle(-1) GUISetState(@SW_SHOW) GUIRegisterMsg($WM_HSCROLL, "hscroll") While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func hscroll($hWnd, $iMsg, $iwParam, $ilParam) #forceref Local $iVal If $ilParam = $hSlider Then $iVal = GUICtrlRead($Slider1) TCPSend($TCPConnect, String($iVal)) EndIf Return "GUI_RUNDEFMSG" EndFuncclient.au3server.au3 Link to comment Share on other sites More sharing options...
guinness Posted June 26, 2011 Share Posted June 26, 2011 Similar question: Maybe use TCPSend($TCPConnect, Number($iVal)) (not tested!) & please in the future have a little patience as people use their spare time to Help others. UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _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 parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
Klovis Posted June 26, 2011 Author Share Posted June 26, 2011 Similar question: Maybe use TCPSend($TCPConnect, Number($iVal)) (not tested!) & please in the future have a little patience as people use their spare time to Help others.I'm sorry, bad habit of panicking. It didn't work just to let you know I think it has to do something with the loops like it'll get through the first send but then it wont take any more info from the client. I notice on the boards that once a post or two have been made people tend to leave it alone because they think it has been resolved. Link to comment Share on other sites More sharing options...
guinness Posted June 26, 2011 Share Posted June 26, 2011 (edited) That's not the case at all, for Example I've never really used TCP in my programs so my Help is limited in this particular problem. But looking at the Sever Script that whole Do loop is wrong, perhaps this and you're waiting for $GUI_EVENT_CLOSE but there is no GUIGetMsg() >>Warning: Not Tested!#include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> TCPStartup() $TCPListen = TCPListen(@IPAddress1, 1000) $TCPPrevious = "" $Form1 = GUICreate("Server", 30, 14, @DesktopWidth - 31, 0, $WS_POPUP) $Label1 = GUICtrlCreateLabel("", 0, 0, 30, 17) GUISetState(@SW_SHOW) Do $TCPAccept = TCPAccept($TCPListen) Until $TCPAccept <> -1 While 1 $TCPRecv = TCPRecv($TCPAccept, 255) If $TCPRecv <> "" And $TCPRecv <> $TCPPrevious Then $TCPPrevious = $TCPRecv GUICtrlSetData($Label1, $TCPRecv) EndIf $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEndI used the Examples in TCPSend() & TCPRecv() as a basis for Help, in there they use StringToBinary() & BinaryToString() perhaps you should too. Edited June 26, 2011 by guinness UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _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 parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
Klovis Posted June 26, 2011 Author Share Posted June 26, 2011 That's not the case at all, for Example I've never really used TCP in my programs so my Help is limited in this particular problem. But looking at the Sever Script that whole Do loop is wrong, perhaps this and you're waiting for $GUI_EVENT_CLOSE but there is no GUIGetMsg() >> Warning: Not Tested! #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> TCPStartup() $TCPListen = TCPListen(@IPAddress1, 1000) $TCPPrevious = "" $Form1 = GUICreate("Server", 30, 14, @DesktopWidth - 31, 0, $WS_POPUP) $Label1 = GUICtrlCreateLabel("", 0, 0, 30, 17) GUISetState(@SW_SHOW) Do $TCPAccept = TCPAccept($TCPListen) Until $TCPAccept <> -1 While 1 $TCPRecv = TCPRecv($TCPAccept, 255) If $TCPRecv <> "" And $TCPRecv <> $TCPPrevious Then $TCPPrevious = $TCPRecv GUICtrlSetData($Label1, $TCPRecv) EndIf $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd I used the Examples in TCPSend() & TCPRecv() as a basis for Help, in there they use StringToBinary() & BinaryToString() perhaps you should too. You forgot to delcare the $TCPPrevious so I just set it local in the while statment and it worked like a charm! thank you so much for working with me!!! Link to comment Share on other sites More sharing options...
guinness Posted June 26, 2011 Share Posted June 26, 2011 Well I would've but you're not using Global/Local Variables so I didn't see it necessary and the Scope is Global as this is not in a Function Also don't set Variables in Loops as this slows the Loop down, always declare variables at the top of the Script/Function. UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _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 parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 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