LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

TCP Write only sends once

I've created a simple client that sends a string to a server. This works correctly but the TCP Write will only send this message once. I have to close my Client and restart it to have it send again. I've attached my client vi. Thank you in advance for your help.

0 Kudos
Message 1 of 5
(3,115 Views)

What are you sending the data to?  How do you know it only writes once?  Are you getting an error after the first or the second time  you do the TCP Write?

 

Is it possible the device on the other end is closing the TCP connection after receiving the first message?

0 Kudos
Message 2 of 5
(3,113 Views)

I've attached the vi that I'm sending the data to. The second and third sequence has the server functions. This vi has other dependencies so it's only for viewing. I can see the data being received as the server displays the string. I don't get any errors when I run the client.  I'm thinking that it is possible that the server may be closing the connection, though I don't see how.

0 Kudos
Message 3 of 5
(3,091 Views)

A quick glance suggests the problem is the receiving side. After you receive one message, you go back to waiting for a new connection (TCP Listen) instead of looking for new data on the existing connection. The sending side keeps sending data, but the receiving side never reads it.

 

The receiver code should get cleaned up. The sequence structure is unnecessary, especially the frame that has nothing in it but wires!

0 Kudos
Message 4 of 5
(3,080 Views)

Thank you nathand. Now I see what's going on. I will also clean up the sequence or eliminate it. I guess I can use the error braid to connect different items.

0 Kudos
Message 5 of 5
(3,078 Views)