LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Datasocket packets sent and received

Maybe this is a simple question but searching the site nobody raised it.

Here is what I noticed using datasocket: I monitored my Datasocket server and I set up my time out for reading datasocket information exchanged between the two application I built to be able to see as many packets I sent the similar number I received (this procedure was done in Labview code). I finished building the executables of the two applications but when I monitor the Datasocket server I see up to twice sent packets the the ones I received. What is the cause of this numbers difference when I am using Labview code or executable and what I see is it correct or wrong?

Thank you,

Virginia

0 Kudos
Message 1 of 8
(3,865 Views)

Hi Virginia_Soloman,

 

Could you post your server and client VIs so we better see the behavior you are seeing?

Peter T
Applications Engineer
National Instruments
0 Kudos
Message 2 of 8
(3,834 Views)

I am afraid I can not send to this side the code, or I will send it after I clarify some problems related the these packets sent and received.

Even for the datasocket examples from Labview I see different number of packets sent and received. Sometimes even if these numbers are different when I see the details of the the datasocket process nothing dropped from the packets. Then what is the meaning of the packets, why are there more sent then received? Is any attempt to send internally more then once?

 

The reason not sending the code is because inside of one of the application I have high speed camera drivers, so for you not having any camera the code can not be ran.

Best regards,

Virginia

 

0 Kudos
Message 3 of 8
(3,819 Views)

Hi Virginia_Soloman,

 

You should see the same functionality between running the application in the development setting vs running the applications as executables.  Datasockets use the TCP/IP protocol to send information so the server should "handshake" with the client before sending information, so it should send once per "handshake".  Are you handling timeout situations where if you don't get a reply within a certain time you send the data again?  Because it could be a difference in seeing more latency in using the executable for some reason. 

 

Have you tried running the server and client executables on the same computer?  If you don't see this functionality on the same computer it would pinpoint the problem to how the network is handling the information.

 

Have you tried making a debuggable executable to see what is happening?  Here is a link how to do this:

 

https://knowledge.ni.com/KnowledgeArticleDetails?id=kA03q000000YHpiCAG&l=en-US

 

Peter T
Applications Engineer
National Instruments
0 Kudos
Message 4 of 8
(3,799 Views)

Thank you for replay.

This is first time when I used datasocket. I used it in localhost but in the same time I have a lot of other devices with TCP communication driven in my software.

To be honest I have experience with Labview enough and all types of communication protocol but it look the datasocket is very unreliable. Sometimes works well but another time is like upside down. I want to explain my code:

I have commands sent from my server to the client via datasocket (commands are not timed out) waiting after that for an acknowledge from client that command was executed (waiting is in a loop with time out repetitive until received). Client waits in receiving server's commands with time out and client send back to server thru another datasocket thread that the command was received and executed. As you can see all datasocket write are not timed out and sent from a connection string but read datasocket are timed out from another connection string and I set specially the software to receive that acknowledge in loop.

One question: if I write a certain type of data thru a datasocket connection string then can I send another time another type thru it even if I code it correctly (write) and I decoded correctly (read)? In particular I always send the same type of data in my code but I wonder if I could do this.

My next thought is to replace everything with shared variable but I have another ones for other purposes in my over 6000 vis.

Any suggestion after I described my design software?

Virginia

0 Kudos
Message 5 of 8
(3,781 Views)

Hi Virginia_Soloman,

 

So my only suggestion is to use the appropriate practices that National Instruments outlines in our DataSocket tutorial:

 

http://www.ni.com/white-paper/3224/en/ 

 

As far as sending multiple types of data, the best solution is to flatten the data you want to send to a string and then type cast it on the receiving end. 

Peter T
Applications Engineer
National Instruments
0 Kudos
Message 6 of 8
(3,762 Views)

The link http://www.ni.com/white-paper/3224/en/ no longer works,

Could you please update?


Engineering - The art of applied creativity  ~Theo Sutton
0 Kudos
Message 7 of 8
(3,581 Views)

Hi,

 

It looks like this is the only data socket tutorial I can find on our website:

 

Connecting LabVIEW to an OPC Server Using Front Panel DataSocket
https://knowledge.ni.com/KnowledgeArticleDetails?id=kA03q000000x2C7CAI&l=en-US

 

If you have any additional questions, please post a new question on the forums.

 

Regards,

 

Alex C.

Applications Engineer

National Instruments

Alex C.
Applications Engineering
National Instruments
0 Kudos
Message 8 of 8
(3,570 Views)