03-13-2020 11:19 AM - edited 03-13-2020 11:21 AM
Hi Experts,
When the OK button is clicked, I want to pass 2 data namely DA1 and DA2 along with their respective packet structure(everything is available in the vi). While verifying the sent data through Wireshark, I want the DA1 data to be displayed post which DA2 data needs to be displayed i.e one after the other and not like a single shot of data and send it via UDP protocol. I am attaching my vi here. Kindly requesting your expert advice to accomplish the same. Thank you in advance.
03-13-2020 11:43 AM
You can send each with it's own UDP function.
Your problem is much deeper thought and I would recommend to clean up your VI because there is a lot of unnecessary, wrong, and overly complicated code constructs that make no sense.
Here's just a small glimpse:
And why do you need a timeout event? Just to poll the logout button to close the panel while keeping the VI running? Most of your local variables are not needed.
You have a very simple problem: form two messages and send them via UDP. Should be possible with 10% of the code! Start with some basic tutorials.
03-13-2020 01:00 PM
May I know what do you try to intend by You can send each with it's own UDP function.? kindly explain the process.
03-13-2020 07:40 PM
@Diaspora wrote:
May I know what do you try to intend by You can send each with it's own UDP function.? kindly explain the process.
Well, you have an "udp send". You are of course allowed to have more than one. If order matters, ensure correct dataflow.
03-13-2020 11:59 PM
Yes I can use multiple UDP's but I want to send the data on a particular port only. Doesn't it create a conflict when I use multiple UDP write with a same port number?
03-14-2020 01:23 AM - edited 03-14-2020 01:26 AM
@Diaspora wrote:
Yes I can use multiple UDP's but I want to send the data on a particular port only. Doesn't it create a conflict when I use multiple UDP write with a same port number?
Presumably not. Otherwise, how would you ever send a second message? For example in a loop - surely you wouldn't want to send to a different port every iteration?
Given your writes have different formats, you'll need to handle that at the receiver (because it might not know which format is coming next, depending on your code design). So make sure it could in principle handle them individually (even if you want it to be an error if a DA2 packet arrives without/before DA1 etc).
Some notes now that I'm searching through your code:
03-14-2020 04:08 AM
Here's a tidied version that should be almost exactly equivalent.
It might be easier to work from this version if you agree it is the same.
The attached VI is backsaved to 2014 (seemed to be the source version).
The snippet is saved with 2019 so incompatible.
I'm pretty confused about the intention with the For loop - perhaps this is intended to be used to send separate packets?
In which case you might (instead of placing them all in one array) create two separate arrays of your headers + data blocks (DA1 and DA2 as two separate array structures) then call UDP Write twice as was described.
03-14-2020 12:55 PM - edited 03-14-2020 12:57 PM
@Diaspora wrote:
Yes I can use multiple UDP's but I want to send the data on a particular port only. Doesn't it create a conflict when I use multiple UDP write with a same port number?
UDP is a connectionless protocol and you can use a connection ID to connect to as many other devices and ports in any order you want. The connection ID basically just defined the local source port. Why would that create a conflict?
To send two different messages you can use two instances ot UDP send, or just use a FOR loop:
Your questions and your attached code tells me that you are not really ready for this entire project. I strongly recommend to start again with LabVIEW and networking tutorials. I hope you are just doing this just as a hobby. Especially focus on LabVIEW array operations.
We might be able to help more if you describe in simple terms what you want to to and what the message structure is. I am sure it can be done with code the size of half a postcard if done right. This is a simple problem and does not need or deserve such complicated code.