LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

UDP Error 66

I have two machines running labview, one is sending and one is receiving via udp. They both work well, however as soon as I stop the vi on the receiving machine I get error 66 "the network connection was closed by the peer" on the sending machine. It taws my understanding that UDP doesn’t do error checking, so I shouldn’t be getting this error. Any thoughts? Attached is my udp programs, the server file takes in UDP data from another computer and sends it to the long ez data display.

0 Kudos
Message 1 of 6
(5,433 Views)
here is the server file
0 Kudos
Message 2 of 6
(5,432 Views)
0 Kudos
Message 3 of 6
(5,431 Views)

Something just doesn't look right in your server app.  You are opening a single UDP connection, but reading and writing data to the same connection from within the loop.  In general, UDP is one directional.  One part sends, another part receives.  Yet you have the server reading, then writing on the same UDP port reference wire.

I'd suggest taking a closer look again at the UDP example programs.

Be careful with your programming style.  In your receiver program, you have the UDP close connection which is actually wired outside of the loop laying on top of the loop as shown by the shadows.  That makes it really hard to read what is going on in the program.  Also, you have numerous places where wires run backwards.  The data on the wires should always flow from left to right and top to bottom.  As you have it, it is difficult to tell what wires are inputs to different functions and which are outputs.  Many of the structures seem duplicated and could probably be placed into subVI's.

0 Kudos
Message 4 of 6
(5,417 Views)

Just in case anyone finds this in the future because they're super confused about UDP reporting that the other side goes away... which totally shouldn't happen, what the heck NI... the above remarks are wrong. A single UDP reference can definitely be used for both directions. Be careful of extrapolating from examples meant to teach you the basic mechanisms.

 

Now why the heck does UDP ever return error 66... It's supposed to be connectionless. Data is delivered to the port on the system or it isn't. Data can be sent to a receiver from multiple senders. A sender can send to multiple receivers... it's why address and port are specified at time of write and reads return the sender's endpoint.

~ Helping pave the path to long-term living and thriving in space. ~
0 Kudos
Message 5 of 6
(103 Views)

I'm not sure what is the exact problem. The app in question seems weird since both the server and client try to read from the network and the server then sends the data on the same socket out again. Feels weird.

 

If I run the Simple UDP example in LabVIEW 2025 Q3 I can not reproduce this no matter how often I stop either the server or client while the other is running! So in general UDP in LabVIEW seems to work as I would expect it to work, but there might be some weird interaction going on in the example from this thread and/or it is something from an older LabVIEW version or maybe even system configuration dependent with number of network adapters or whatever. 

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 6 of 6
(44 Views)