Jump to content

TCP/UDP Binary?


Recommended Posts

Is it possible to receive Binary data in AutoIt from a program other than AutoIt (for example...a C++ program that sends out one float)?

I'm using beta version 3.2.3.14. My C++ program continuously sends out one float and I would like to display this number in AutoIt. Is this possible solely through AutoIt code?

My code below does nothing when the UDP data of the float is received.

#include <GUIConstants.au3>
     
     UDPStartup()
     
     $socket = UDPBind("127.0.0.1", 3333)
     If @error <> 0 Then
         MsgBox(0,"Testing","Error binding...")
         Exit
     EndIf
     
     #Region ### START Koda GUI section ### Form=
     $Form1 = GUICreate("Server", 338, 249, 193, 114)
     $Label1 = GUICtrlCreateLabel("", 72, 72, 400, 17)
     GUISetState(@SW_SHOW)
     #EndRegion ### END Koda GUI section ###
     
     While 1
         $nMsg = GUIGetMsg()
         Switch $nMsg
             Case $GUI_EVENT_CLOSE
                 Exit
         EndSwitch
         
         $data = UDPRecv($socket, 50)
         If $data <> "" Then
             If IsBinary($data) Then
                 GUICtrlSetData($Label1,"Binary: " & String($data))
             Else
                 GUICtrlSetData($Label1,"String: " & $data)
             EndIf
         EndIf
     WEnd
     
     Func OnAutoItExit()
         UDPCloseSocket($socket)
         UDPShutdown()
     EndFunc

Thanks,

Livewire

Edited by livewire
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...