From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Error message pops up at wrong time

Dear Experts,

 

I have designed a client - server model. Need your advise to fix this issue.

 

How it works?

1. Client.vi sends a message to server.vi

2. Upon receiving the server displays a dialog box saying "Received Successfully!
Waiting for Acknowledgement"

3. When the user clicks on "OK" button on the dialog box , it displays one more dialog box saying "Ack successful"

4. In case, if the network cable is unplugged or the particular port is not opened on the server.vi end, it should pop up an error message saying "server not connected".

 

Issue faced: This is where I am facing issue. When I run the VI, each and every time, this error message pop's up. Instead it needs to open up only when sending of data is getting failed with a timeout of 5 second. Kindly help me. Thank you. Herewith, I attach both the client.vi and server.vi.

salauddin_0-1574759652814.png

Download All
0 Kudos
Message 1 of 10
(2,404 Views)

Dear Experts,

 

I have developed this Multicast UDP –sender receiver code. Now I need to include a ‘send acknowledgement’ button in the server.vi. When this button is clicked it has to display a ‘message received successfully’ pop up on the client.vi end. Could anyone throw light how this can be achieved? Herewith, I attach both the server.vi and client.vi here. Thank you in advance.

Download All
0 Kudos
Message 2 of 10
(2,300 Views)

Hi Salauddin,

 

I don't see the image that you attached in either of the attached VIs - the image shows some code that will always give you the "error message", because it is in the no-error state, but I don't see it present in the VIs.

 

On the topic of the VIs, they are quite complicated to read, and the tab controls don't help with this. You might consider trying to convert them into something more like a State Machine, because that will probably more accurately model what you're trying to do (i.e. transition between various states). Consider using the Disabled property for controls if needed ("Disabled and Greyed Out", for example) rather than switching between tabs of similar controls.


GCentral
0 Kudos
Message 3 of 10
(2,385 Views)

Dear Sir,

 

I will learn about the state machines. For now, I assure that the attached image in my question from the MultiCastClient.vi attached. I once ensured it myself and I have uploaded the correct file. Your help will be really appreciated. Kindly help me, Sir.

0 Kudos
Message 4 of 10
(2,366 Views)

Hi salauddin,

 


@salauddin wrote:

Issue faced: This is where I am facing issue. When I run the VI, each and every time, this error message pop's up. Instead it needs to open up only when sending of data is getting failed with a timeout of 5 second.


The dialog is shown each time that "no error" case is executed - that's how YOU have programmed it.

When the dialog should only show for a certain condition then you need to implement code to test for that condition!

(Btw. it's very unlikely that sending an UDP message is going to fail…)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 10
(2,360 Views)

Dear experts,

I send a message from MulticastClient.vi to MulticstServer.vi. Upon receiving a message, the MulticstServer.vi pop ups a message "received successfully, send acknowledgement". When OK button is clicked, I receive a popup on the MulticastClient.vi end saying, "Acknowledgement successful".

 

I need to include a code where after a timeout of 5 seconds of sending the message from MulticastClient.vi and if it was received successfully(i.e server end ports not open or network cable unplugged) it should throw a error message saying, "server not connected".

Herewith, I attach both the MulticastClient.vi and MulticstServer.vi VIs. Kindly help.

Download All
0 Kudos
Message 6 of 10
(2,332 Views)

" if it was received successfully(i.e server end ports not open or network cable unplugged) it should throw a error"

 

Do you mean if it was NOT received successfully?

0 Kudos
Message 7 of 10
(2,301 Views)

Yes, you are right. It means s NOT received successfully only. (i.e) indicating a failure.

0 Kudos
Message 8 of 10
(2,289 Views)

I am assuming that you did not write that messy, disorganized, confusing piece of code that you attached to this request.  This is a wonderful example of the advice I've given colleagues who present me with such a mess:

  • Step 1 -- delete the existing code (and all copies of it).
  • Step 2 -- break out your favorite Word Processor (Word, LaTeX, whatever) and write a one-two page document describing what you want to do.  Describe how things start out, what starts things going, what signals go back and forth, what causes things to change, and what ultimate end(s) are anticipated.
  • Note that the document should focus on "what", not "how".  If there is a critical methodology (such as a requirement to use, say UDP as a communication mechanism (instead of TCP, Network Streams, HTTP, or something else), that's OK, but don't focus too much on "how".
  • If things are taking place in a sequence ("first initialize, then do this, then wait for that, then respond such and so"), a good model for this might be a State Machine, perhaps implemented either using something like the Queued Message Handler (using the NI Template) or the JKI State Machine (obtained from the NI Tools Network).
  • Share your Document with your colleagues, your boss, someone who can follow a logic argument (doesn't need to know LabVIEW, because your Document shouldn't mention LabVIEW, just "what" you are trying to do).
  • Once you have a simple model based on a simple Design, start coding.  Do it one State at a time, testing as you go.

Bob Schor

0 Kudos
Message 9 of 10
(2,251 Views)

Wow! Such a beautiful explanation. Thank you so much Bob_Schor for your time and kindness. I will follow.

0 Kudos
Message 10 of 10
(2,234 Views)