Showing results for 
Search instead for 
Did you mean: 

Receiving UDP Packets from another application.

Hey guys,


So I am using Unity to create a virtual environment, where I am moving an object around the space.

Then I am using a script to send OSC UDP messages out which contain the coordinates of that object as it moves. I am trying to receive the message in Labview and this other program called Max MSP for audio routing. When receiving in Labview, I want to take this data and store it for analysis later.


The issue I'm having is that when I send this data out, the received message (in string format) is not the number I am sending. Even when I use another program to send a simple floating point number such as 0.5, the Labview string received is something like: "float, f $" (without quotes). 


I am using the simple UDP example for now and plan on modifying it, with an extra string display to monitor what is received. I know the message being sent isn't the problem since I can send and receive from Unity to Max.


Below, a screenshot showing a trial of this, Max sending a floating point number (with a dial) and Labview receiving on the right (with the string displayed). I know Labview is receiving the signal since as I rotate the dial and therefore change the number being sent, the time graph moves to the right as if writing "0" as it changes and the string displayed changes depending on the number being sent.


Any help would be appreciated, further information can be given if need.



0 Kudos
Message 1 of 14

@Equin0x wrote:

Hey guys,  Not every LabVIEW user is a "guy" ...



In addition to a picture (definitely not worth 1000 words), it you attach a VI, we can better see what you are trying to do, it would save us time/effort if we want to help (since we could try your code, modify it to see "what works", etc.).


Bob Schor

0 Kudos
Message 2 of 14

Hey Bob! Thanks for the quick reply.


To get this exact VI, you can just use the example VI provided by Labview itself called "Simple UDP - Receiver"

All I did is add the display to the string that I'm sure any user could do that would be able to help me 🙂


Also, guys is meant to be a general term I used (sorta like mankind where we obviously don't only mean men). I did not mean males only, because of course men and women could use this software. If I did, all three of my older sisters would be pretty disappointed in me!



0 Kudos
Message 3 of 14

Thanks for the quick response.  Knowing that the example VI is the Simple UDP - Receiver example to which you added a display of the string certainly helps me to recreate your code for testing to see if I can help you.  Thanks.


And you are correct -- while the definition of "guy" is "a man", "guys" can be used with a group having both men and women.  Mankind, in contrast, means humans, regardless of gender.  "You can look it up" ...


Sadly, I suspect an NI Update has clobbered the NI Locator Service, so I cannot open examples on my machine at work.  I'll look into seeing if I can help you after dinner, using my home PC ...


Bob Schor

0 Kudos
Message 4 of 14

Your string output seems to be in a complicated format with words and such, so you just need to know what the exact format is in order to parse the value correctly.


Firstly, your string indicator is too short so we might not even see the entire string and your screenshot is scaled down so it all looks blurry anyway.


In order to analyze the string you receive it would really help if you could run your VI until the string contains data, then right-click the terminal...create constant. Place that constant (now containing a typical string) into a new VI, save it under a new name, and attach it here. (Do not paste the raw text here!)




To me it looks like a string with multiple sections. A header in clear text containing information about the datatype (float ,f ...) followed by a possibly binary string that needs to be cast to SGL or DBL. possibly followed by a termination character. Hard to tell the details.

LabVIEW Champion. It all comes together in GCentral GCentral
0 Kudos
Message 5 of 14

OK, so I ran the Simple UDP example Project.  It was extremely simple (the directions were printed right on the Front Panels) -- I started Simple UDP - Sender, noticed that it seemed to be sending U(0, 1) random numbers twice a second.  I then ran Simple UDP - Receiver, and noticed that it started plotting U(0, 1) data at 2 Hz.  So it looks (to me) like it was working perfectly.  The code seems OK, so why didn't it work for you?


Bob Schor

0 Kudos
Message 6 of 14

@Bob_Schor wrote:

The code seems OK, so why didn't it work for you?


I think he is only using the example for the receiver. The sender is a different program.

LabVIEW Champion. It all comes together in GCentral GCentral
0 Kudos
Message 7 of 14

@altenbach wrote:

@Bob_Schor wrote:

The code seems OK, so why didn't it work for you?


I think he is only using the example for the receiver. The sender is a different program.

Of course, but if there is no-one sending a coherent "message" on the UDP channel, you can hardly fault the UDP Receiver if it fails to deliver a meaningful message.  Bob's Corollary of "Garbage In, Garbage Out" is "Nothing In, Nothing Out".

0 Kudos
Message 8 of 14

Yes, receiving data fully works, even with the other sender. The string is not empty 😄


The only problem is the parsing and interpretation of the received string. I was trying to solve that by requesting the exact bits, but so far I have not seen anything. It would also help to see the documentation for the sender program. Do we have access to the source code? I assume that the sender is not written in LabVIEW.

LabVIEW Champion. It all comes together in GCentral GCentral
0 Kudos
Message 9 of 14

I’m traveling right now but I’ll be able to respond fully today or tomorrow. 


The sender program as stated is Max MSP. 


Sending data to other applications works fine. Also, I already know the sender/receiver in labview works with itself. It is EXTREMELY SIMPLE. 


However, when using any other program it seems like the receiving end on labview gets very strange string values. I will further investigate soon and also show you the whole string from the screenshot that was requested. 


I don’t blame the receiver itself but it’s strange that this only occurs on labview. 


Thanks for for the help so far. I’ll get back to you all soon. 

0 Kudos
Message 10 of 14