zxtnt09 Posted October 13, 2015 Share Posted October 13, 2015 (edited) Hi guys,I have a biiiiiiiiiiiig problem and i'll be happy if it was be solved,My question is :If i use this file : "Client (32 Bit).exe" file , i can connect to "Server.exe",But when ever i try to edit "Client.au3" file for my own,it can not connect to "Server.exe" !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!================================== | *Notes* |* "Server.exe" was in "VPS"*Client (32 Bit).exe was attached.*Client.au3 was attached.*Server.exe was attached.*Server.au3 was attached.==================================Client.au3 : expandcollapse popup#RequireAdmin #Include <ButtonConstants.Au3> #Include <EditConstants.Au3> #Include <GUIConstantsEx.Au3> #Include <StaticConstants.Au3> #Include <WindowsConstants.Au3> #Include <GUIEdit.Au3> #Include <Misc.Au3> ;~ #NoTrayIcon Opt ('GUIOnEventMode', 1) TcpStartUp () Global $Server = -1, $Logs $Settings = GUICreate ('Connection Settings', 180, 100, -1, -1, -1, 128) GUISetOnEvent ($GUI_EVENT_CLOSE, '_Exit') GUICtrlCreateGroup ('', 5, 0, 170, 94) $IP = GUICtrlCreateInput (IniRead ('Settings.ini','Settings','IP',0), 12, 13, 100, 21, 1) $Port = GUICtrlCreateInput (IniRead ('Settings.ini','Settings','Port',0), 117, 13, 50, 21, 1) $User = GUICtrlCreateInput (IniRead ('Settings.ini','Settings','User',0), 12, 39, 156, 21, 1) $Connect = GUICtrlCreateButton ('Connect', 12, 66, 100, 20, $WS_GROUP) GUICtrlSetOnEvent ($Connect, '_Start') $Exit = GUICtrlCreateButton ('Exit', 117, 66, 50, 20, $WS_GROUP) GUICtrlSetOnEvent ($Exit, '_Exit') GUISetState (@SW_SHOW) WinSetOnTop ($Settings, '', 1) $GUI = GUICreate ('TCP Chat Room', 375, 275, -1, -1, -1, 128) GUISetOnEvent ($GUI_EVENT_CLOSE, '_Toggle') $History = GUICtrlCreateEdit ('', 0, 1, 375, 203, 2103360 + $ES_MULTILINE) GUICtrlSetFont ($History, 10, -1, -1, 'Lucida Sans Unicode') GUICtrlSetBkColor ($History, 0x83B4FC) GUICtrlSetColor ($History, 0xFFFFFF) $Send = GUICtrlCreateEdit ('', 0, 205, 375, 70, 2101248) GUICtrlSetFont ($Send, 10, -1, -1, 'Lucida Sans Unicode') GUICtrlSetColor ($Send, 0x83B4FC) GUISetState (@SW_HIDE) While 1 Sleep (15) If $Server <> -1 Then $Recv = TcpRecv ($Server, 1000000) If @Error Then GUISetState (@SW_HIDE, $GUI) WinSetOnTop ($GUI, '', 0) Sleep (100) MsgBox (48, 'Server Notice','You have been disconnected from the server.') _Disconnect () EndIf If $Recv = 'Error:Username.Exists;' Then GUISetState (@SW_HIDE, $GUI) WinSetOnTop ($GUI, '', 0) Sleep (100) MsgBox (48, 'Server Notice','Your username is already in use, please change it and try again.') _Disconnect () ElseIf $Recv = 'Error:Max.Connections;' Then GUISetState (@SW_HIDE, $GUI) WinSetOnTop ($GUI, '', 0) Sleep (100) MsgBox (48, 'Server Notice','Max amount of connections reached, try again later.') _Disconnect () ElseIf $Recv = 'Error:IP.Banned;' Then GUISetState (@SW_HIDE, $GUI) WinSetOnTop ($GUI, '', 0) Sleep (100) MsgBox (48, 'Server Notice','Your IP address has been banned.') _Disconnect () ElseIf StringLeft ($Recv, 4) = '.log' Then FileWriteLine ('Logged.txt', StringTrimLeft ($Recv, 5)) ElseIf $Recv <> '' Then _Log (StringReplace ($Recv, '%Time', @HOUR & ':' & @MIN)) EndIf If _IsPressed ('0D') And GUICtrlRead ($Send) <> '' And ControlGetFocus ($GUI) = 'Edit2' Then $Read = StringReplace (GUICtrlRead ($Send), @CRLF, '') $Read = StringReplace ($Read, @CR, '') $Read = StringReplace ($Read, @LF, '') If $Read = '.clear' Then GUICtrlSetData ($History, '') ElseIf $Read = '.logs' Then _Logs () ElseIf $Read = '.save' Then FileWrite (@MDAY & '-' & @MON & '-' & @YEAR & '_' & @HOUR & '-' & @MIN & '-' & @SEC & '_Logs.txt', GUICtrlRead ($History)) ElseIf $Read = '.disconnect' Or $Read = '.exit' Then _Disconnect () Else TcpSend ($Server, $Read) EndIf GUICtrlSetData ($Send, '') EndIf EndIf WEnd Func _Logs () $Logs = GUICreate ('Admin Logs', 375, 203, -1, -1, -1, 128) GUISetOnEvent ($GUI_EVENT_CLOSE, '_Delete') $Edit = GUICtrlCreateEdit ('', 0, 1, 375, 203, 2103360 + $ES_MULTILINE) GUICtrlSetFont ($Edit, 10, -1, -1, 'Lucida Sans Unicode') GUICtrlSetBkColor ($Edit, 0x83B4FC) GUICtrlSetColor ($Edit, 0xFFFFFF) GUISetState (@SW_SHOW) GUICtrlSetData ($Edit, FileRead ('Logged.txt')) WinSetOnTop ($Logs, '', 1) EndFunc Func _Delete () GUIDelete ($Logs) EndFunc Func _Disconnect () GUICtrlSetData ($History, '') TcpCloseSocket ($Server) $Server = -1 GUISetState (@SW_HIDE, $GUI) WinSetOnTop ($GUI, '', 0) GUISetState (@SW_SHOW, $Settings) WinSetOnTop ($Settings, '', 1) EndFunc Func _Toggle () GUICtrlSetData ($History, '') TcpCloseSocket ($Server) $Server = -1 GUISetState (@SW_HIDE, $GUI) WinSetOnTop ($GUI, '', 0) GUISetState (@SW_SHOW, $Settings) WinSetOnTop ($Settings, '', 1) EndFunc Func _Log ($Data) GUICtrlSetData ($History, GUICtrlRead ($History) & $Data & @CRLF) _GUICtrlEdit_LineScroll ($History, 0, _GUICtrlEdit_GetLineCount ($History) - 1) EndFunc Func _Start () If GUICtrlRead ($User) == '' Or GUICtrlRead ($IP) == '' Or GUICtrlRead ($Port) == '' Then Return @Error $Server = TcpConnect (GUICtrlRead ($IP), GUICtrlRead ($Port)) If $Server = -1 Or @Error Then WinSetOnTop ($Settings, '', 0) Sleep (100) MsgBox (16, 'Fatal Error','Unable to connect to the server, change your settings and try again.') WinSetOnTop ($Settings, '', 1) Return @Error EndIf Sleep (150) TcpSend ($Server, GUICtrlRead ($User)) GUISetState (@SW_HIDE, $Settings) WinSetOnTop ($Settings, '', 0) GUISetState (@SW_SHOW, $GUI) WinSetOnTop ($GUI, '', 1) EndFunc Func _Exit () IniWrite ('Settings.ini','Settings','IP', GUICtrlRead ($IP)) IniWrite ('Settings.ini','Settings','Port', GUICtrlRead ($Port)) IniWrite ('Settings.ini','Settings','User', GUICtrlRead ($User)) Exit EndFunc==================================I use this UDF Example : Thanks and i really need your helps Client (32 Bit).exeClient.au3 Server.au3 Server (32 Bit).exe Edited October 13, 2015 by zxtnt09 File Attached Link to comment Share on other sites More sharing options...
zxtnt09 Posted October 13, 2015 Author Share Posted October 13, 2015 Nobody help Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted October 13, 2015 Moderators Share Posted October 13, 2015 zxtnt09,You have been here long enough to know not to bump your own threads within 24 hours.Remember this is not a 24/7 support forum - those who answer are only here because they like helping others and have some time to spare. You just have to wait until someone who knows something about your particular problem, and is willing to help, comes online. Be patient and someone will answer eventually.M23 zxtnt09 1 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
zxtnt09 Posted October 13, 2015 Author Share Posted October 13, 2015 zxtnt09,You have been here long enough to know not to bump your own threads within 24 hours.Remember this is not a 24/7 support forum - those who answer are only here because they like helping others and have some time to spare. You just have to wait until someone who knows something about your particular problem, and is willing to help, comes online. Be patient and someone will answer eventually.M2314 Hours != 24 i'm so sorry Sorry,i really need to know that, why this exe file is not similar source file,all of those run , but "compiled" file ( from autor ) is fixed, but if i try to compile that, not connect to server... !!!!and it is so strange for me Link to comment Share on other sites More sharing options...
zxtnt09 Posted October 14, 2015 Author Share Posted October 14, 2015 not help yet Link to comment Share on other sites More sharing options...
zxtnt09 Posted October 16, 2015 Author Share Posted October 16, 2015 not help yet, Link to comment Share on other sites More sharing options...
JohnOne Posted October 16, 2015 Share Posted October 16, 2015 (edited) Looks a bit odd to me at first glance, since the error you are getting comes from within a function which appears never to be even called.Searched "_Start " instead of "_Start" Edited October 17, 2015 by JohnOne zxtnt09 1 AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
zxtnt09 Posted October 16, 2015 Author Share Posted October 16, 2015 Looks a bit odd to me at first glance, since the error you are getting comes from within a function which appears never to be even called.And what is that meant ?1 i don't know why and how to fix that,all of those source code ( maybe i think ) is same,but i can just run that "Client (32 bit).exe" and i can not modify "Client.au3" Link to comment Share on other sites More sharing options...
JohnOne Posted October 17, 2015 Share Posted October 17, 2015 Change this code...If $Server = -1 Or @Error Then WinSetOnTop ($Settings, '', 0) Sleep (100) MsgBox (16, 'Fatal Error','Unable to connect to the server, change your settings and try again.') WinSetOnTop ($Settings, '', 1) Return @Error EndIfTo this code...If $Server = -1 Or @Error Then $iError = @error WinSetOnTop ($Settings, '', 0) Sleep (100) MsgBox (16, 'Fatal Error','Unable to connect to the server, change your settings and try again.' & @crlf & 'Error: ' & $iError) WinSetOnTop ($Settings, '', 1) Return @Error EndIfShow your error zxtnt09 1 AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
zxtnt09 Posted October 17, 2015 Author Share Posted October 17, 2015 Show your error Link to comment Share on other sites More sharing options...
JohnOne Posted October 17, 2015 Share Posted October 17, 2015 10060 Connection timed out. A connection attempt failed because the connected party did not properly respond after a period of time, or the established connection failed because the connected host has failed to respond. See connect timeout example. zxtnt09 1 AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
zxtnt09 Posted October 17, 2015 Author Share Posted October 17, 2015 (edited) If use this , expandcollapse popup#include <MsgBoxConstants.au3> ; I am the client, start me after the server no more than 10sec ! (The server script is the TCPAccept example script). Example() Func Example() TCPStartup() ; Start the TCP service. ; Register OnAutoItExit to be called when the script is closed. OnAutoItExitRegister("OnAutoItExit") ; Assign Local variables the loopback IP Address and the Port. Local $sIPAddress = "127.0.0.1" ; This IP Address only works for testing on your own computer. Local $iPort = 65432 ; Port used for the connection. Opt("TCPTimeout", 1000) Local $nMaxTimeout = 10 ; script will abort if no server available after 10 secondes Local $iSocket, $iError While 1 ; Assign a Local variable the socket and connect to a Listening socket with the IP Address and Port specified. $iSocket = TCPConnect($sIPAddress, $iPort) ; If an error occurred display the error code and return False. If @error = 10060 Then ; Timeout occurs try again $nMaxTimeout -= 1 If $nMaxTimeout < 0 Then MsgBox(BitOR($MB_SYSTEMMODAL, $MB_ICONHAND), "", "Could not connect, after " & 10 - $nMaxTimeout & " TimeOut") Return False EndIf ContinueLoop ElseIf @error Then $iError = @error ; The server is probably offline/port is not opened on the server. MsgBox(BitOR($MB_SYSTEMMODAL, $MB_ICONHAND), "", "Could not connect, Error code: " & $iError) Return False Else MsgBox($MB_SYSTEMMODAL, "", "Connection successful after " & 10 - $nMaxTimeout & " TimeOut") ExitLoop EndIf WEnd ; Close the socket. TCPCloseSocket($iSocket) EndFunc ;==>Example Func OnAutoItExit() TCPShutdown() ; Close the TCP service. EndFunc ;==>OnAutoItExitThe connections goes true !,1 ) thank you i think it's true 2 ) now what should i added in my client script ===================================================Answer : i should add this : Opt("TCPTimeout", 1000)but question : when i use that, my scirpt was lagged and slow !!!!============================[Solved] a : i should set that to "0", Opt("TCPTimeout", 0)..........sp thanks to @JohnOne Edited October 17, 2015 by zxtnt09 Link to comment Share on other sites More sharing options...
JohnOne Posted October 17, 2015 Share Posted October 17, 2015 Ace. zxtnt09 1 AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. 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