Danyfirex Posted February 21, 2016 Share Posted February 21, 2016 Use TCP is not the best way. It will be a lot of work so you need to learn how websocket protocol works. Consider what I've told you before. Saludos Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut Link to comment Share on other sites More sharing options...
water Posted February 21, 2016 Share Posted February 21, 2016 (edited) Great, but what is the value of @error? Edited February 21, 2016 by water My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
mendrofa Posted February 25, 2016 Share Posted February 25, 2016 some one help me please Link to comment Share on other sites More sharing options...
water Posted February 25, 2016 Share Posted February 25, 2016 Again: What is the value of @error you write to the screen using this line? MsgBox(BitOR($MB_SYSTEMMODAL, $MB_ICONHAND), "", "Could not connect, Error code: " & $iError) My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
mendrofa Posted February 25, 2016 Share Posted February 25, 2016 this sir Link to comment Share on other sites More sharing options...
water Posted February 25, 2016 Share Posted February 25, 2016 Two remarks: Your script misses a call to TCPStartup Error 1 stands for "IPAddr is incorrect." See the examples for TCPConnect in the help file. BTW: This information could easily have been found by you by looking into the help file My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
mendrofa Posted February 25, 2016 Share Posted February 25, 2016 this tcp connect, ip adress not using url but number and there are iport #include <MsgBoxConstants.au3> ; I am the client, start me after the server! (Start first 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. ; Assign a Local variable the socket and connect to a Listening socket with the IP Address and Port specified. Local $iSocket = TCPConnect($sIPAddress, $iPort) ; If an error occurred display the error code and return False. If @error Then ; The server is probably offline/port is not opened on the server. Local $iError = @error MsgBox(BitOR($MB_SYSTEMMODAL, $MB_ICONHAND), "", "Could not connect, Error code: " & $iError) Return False Else MsgBox($MB_SYSTEMMODAL, "", "Connection successful") EndIf ; Close the socket. TCPCloseSocket($iSocket) EndFunc ;==>Example Func OnAutoItExit() TCPShutdown() ; Close the TCP service. EndFunc ;==>OnAutoItExit Link to comment Share on other sites More sharing options...
water Posted February 25, 2016 Share Posted February 25, 2016 You should show some effort yourself and not just copy the example script. Where is TCPStartup() ; Start the TCP service. in your script? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
mendrofa Posted February 25, 2016 Share Posted February 25, 2016 expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <MsgBoxConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 315, 233, 192, 124) $Group1 = GUICtrlCreateGroup("", 8, 8, 297, 217) $Input1 = GUICtrlCreateInput("9QeuqAtACdcvjIW", 24, 24, 177, 21) $Button1 = GUICtrlCreateButton("conect socket", 207, 24, 91, 25) $Edit1 = GUICtrlCreateEdit("", 24, 56, 273, 153) GUICtrlSetData(-1, "") GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Select case $nmsg = $button1 tes() Case $nmsg = $GUI_EVENT_CLOSE Exit endSelect WEnd func tes() TCPStartup() OnAutoItExitRegister("OnAutoItExit") Local $sIPAddress = "wss://ws.binaryws.com/websockets/v3" ; This IP Address only works for testing on your own computer. Local $iPort = guictrlread($input1) ; Port used for the connection. ; Assign a Local variable the socket and connect to a Listening socket with the IP Address and Port specified. Local $iSocket = TCPConnect($sIPAddress, $iPort) If @error Then ; The server is probably offline/port is not opened on the server. Local $iError = @error MsgBox(BitOR($MB_SYSTEMMODAL, $MB_ICONHAND), "", "Could not connect, Error code: " & $iError) Return False Else MsgBox($MB_SYSTEMMODAL, "", "Connection successful") EndIf Local $iListenSocket = TCPListen($sIPAddress, $iPort, 100) Local $iError = 0 ; If an error occurred display the error code and return False. If @error Then ; Someone is probably already listening on this IP Address and Port (script already running?). $iError = @error MsgBox(BitOR($MB_SYSTEMMODAL, $MB_ICONHAND), "", "Could not listen, Error code: " & $iError) Return False EndIf ; Assign Local variable to be used by Listening and Client sockets. Local $iSocket = 0 Do ; Wait for someone to connect (Unlimited). ; Accept incomming connexions if present (Socket to close when finished; one socket per client). $iSocket = TCPAccept($iListenSocket) ; If an error occurred display the error code and return False. If @error Then $iError = @error MsgBox(BitOR($MB_SYSTEMMODAL, $MB_ICONHAND), "", "Could not accept the incoming connection, Error code: " & $iError) Return False EndIf Until $iSocket <> -1 ;if different from -1 a client is connected. ; Close the Listening socket to allow afterward binds. TCPCloseSocket($iListenSocket) MsgBox($MB_SYSTEMMODAL, "", "Client Connected.") guictrlsetdata($edit1, $iListenSocket) EndFunc I have added but still error Link to comment Share on other sites More sharing options...
water Posted February 25, 2016 Share Posted February 25, 2016 You noticed that TCPConnect needs a "Internet Protocol dotted address(IpV4) as "192.162.1.1"." as described in the help file? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
water Posted February 25, 2016 Share Posted February 25, 2016 On the other hand it is quite easy to search the forum and find examples for websocket. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki 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