yucatan Posted September 24, 2013 Share Posted September 24, 2013 Hello i'm building an udp server with an udp client but i seems i cant get it working to send a message from the udp server to the udp client Anyone any help? client: expandcollapse popupUDPStartup() ;188.165.40.108:29022 $socket = udpopen("127.0.0.1", 65532) If @error <> 0 Then ConsoleWrite(@error) Exit EndIf ;$cdkey = $argv[3] ;$cdkeypart = substr($cdkey, 0, 16) ;$pbguid = "123456789abcdef1234567890abcdefa" ;ÿÿÿÿgetKeyAuthorize 0 XHU6E7666HHJPAP3 PB 123456789abcdef1234567890abcdefa WL3ZW7QJXJA3P3GE8DE3 $data = "" $auth = udpsend($master, "ÿÿÿÿgetKeyAuthorize 0 P7XLP5EH6A5HJL7L PB 123456789abcdef1234567890abcdefa") $status = udpSend($socket, 'ÿÿÿÿgetchallenge 0') While 1 $data = udpRecv($socket, 99999) if $data <> "" Then ConsoleWrite($data & @CRLF) exitloop EndIf WEnd $challange = StringMid($data, 22, 20) ConsoleWrite($challange&@LF) $challange = StringReplace($challange, " ", "") ConsoleWrite($challange&@lf) UDPSend($socket, "ÿÿÿÿconnect \cg_predictItems\1\cl_anonymous\0\cl_punkbuster\1\cl_voice\1\cl_wwwDownload\1\rate\25000\snaps\20\name\yorickispro\protocol\118\challenge\"&$challange&"\qport\30336") ;ÿÿÿÿconnect "\cg_predictItems\1\cl_anonymous\0\cl_punkbuster\1\cl_voice\1\cl_wwwDownload\1\rate\25000\snaps\20\name\FMNZRIMY\protocol\118\challenge\-1350344700\qport\30336" While 1 $data = udpRecv($socket, 99999) if $data <> "" Then ConsoleWrite($data & @CRLF) ;exitloop EndIf WEnd ;ConsoleWrite($teller & @CRLF) ;until $henk=0 server: expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> #include <StaticConstants.au3> #include <Array.au3> UDPStartup() OnAutoItExitRegister("Cleanup") ; Bind to a SOCKET ;============================================== Local $socket = UDPBind("127.0.0.1", 65532) If @error <> 0 Then Exit Local $file, $btn, $msg, $myedit, $msg GUICreate("My GUI edit",700,700) ; will create a dialog box that when displayed is centered $file = GUICtrlCreateInput("", 10, 650, 300, 20) $myedit = GUICtrlCreateEdit("" & @CRLF, 0, 0, 600, 600, $ES_AUTOVSCROLL + $WS_VSCROLL) $handle = GUICtrlGetHandle ( $myedit ) GUICtrlSetData($myedit, "UDP server started"&@crlf,"1") GUISetState() ; Run the GUI until the dialog is closed While 1 $data = "" $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop Local $data = UDPRecv($socket, 99999) If $data <> "" Then UDPSend($socket[1], "ÿÿÿÿchallengeResponse 1425526264") GUICtrlSetData($myedit, $data &@crlf,"1") WEnd GUIDelete() exit While 1 WEnd sleep (100) $data = "" While 1 Local $data = UDPRecv($socket, 99999) If $data <> "" Then ConsoleWrite($data & @LF) EndIf Sleep(100) WEnd Func Cleanup() UDPCloseSocket($socket) UDPShutdown() EndFunc ;==>Cleanup Link to comment Share on other sites More sharing options...
water Posted September 24, 2013 Share Posted September 24, 2013 Have a look at the example code in UDPRecv and UDPSend. Combine both and you have an UDP client/server application. 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...
yucatan Posted September 24, 2013 Author Share Posted September 24, 2013 water i did take a look in the help filed but the help files only explaine how the client can send to the server that part i got working but i'm unable to use that same socket to send data from the server towards the client Link to comment Share on other sites More sharing options...
water Posted September 24, 2013 Share Posted September 24, 2013 If you send data from A to B then A is the client and B the server. If you then want to send some data back from B to A then A needs to be the server. Which means you need to run client and server on A and B. 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...
yucatan Posted September 24, 2013 Author Share Posted September 24, 2013 Water is this only with autoit applications or is this just the UDP protocol? because for example call of duty uses udp to communicate between client een server but ofcrouse people that play call of duty dont have port forwarding. but still a call of duty server is able to send data towards call of duty players. and i'm sure this is done by udp do you maby have an explaination for that? Link to comment Share on other sites More sharing options...
water Posted September 24, 2013 Share Posted September 24, 2013 Looks like your already has both functions implemented (send and receive). If it is not working you need to add some debugging code (MsgBox etc.). 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...
yucatan Posted September 24, 2013 Author Share Posted September 24, 2013 i think i already found the problem i'm sending towards an socket but thats not working in UDP i think i should be sending toward ip:port gonna check it out tomorrow Kind regards Link to comment Share on other sites More sharing options...
water Posted September 24, 2013 Share Posted September 24, 2013 I don't understand. A socket address is the IP address plus port number. So this aren't two different things. 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...
yucatan Posted September 25, 2013 Author Share Posted September 25, 2013 the problem i'm having is that when i from the server send data towards the socket then the server recieves its own sended data instead of it has been sended towards the client Link to comment Share on other sites More sharing options...
water Posted September 25, 2013 Share Posted September 25, 2013 Looks like the IP used for sending the data is wrong. 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...
yucatan Posted September 25, 2013 Author Share Posted September 25, 2013 water how exacly do you mean ? you mean the UDPSend($socket[1], "ÿÿÿÿchallengeResponse 1425526264") in the server? Link to comment Share on other sites More sharing options...
water Posted September 25, 2013 Share Posted September 25, 2013 If a message you send from the server to the client is being read from the server then you either send the message to the wrong ip:port ip:port is correct but the message is forwarded by the client to the sender 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