LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

tcp/ip communication

client made in labview running in one pc and server made in labview running in other pc.

when client sends one time request to server, server is getting that after some time and continuously getting that command and responding for it but on the other hand client is not receiving that response.

in server side 3 paraller timed loops are running with offsets 100 and 200 ms respectively.

1st loop is a client which is interacting with a server in  a pc having the client for the second loop.

 

0 Kudos
Message 1 of 6
(2,629 Views)

We woudl need to see your ocde to be able to isolate the problem and give you any meaningful advice. Without seeing it all we can say is that you have a bug.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 2 of 6
(2,601 Views)

here m attaching my sample code for TCp server, TCp server is able to receive the command from client only once first time of execution after that it always show timeout error 56, even client is sending request to it as we have confirmed it by smsniffer software as that is detecting all commands but TCP server is not able to read the commands but here it is able to detect the connectivity with the client as we have provided an boolean indicator which in indicating the connection OK NOK at the top.

 

TCP read is behaving anonymously every first time it receives the command after that it doesnt receive or when client has sent the command and get closed after that server is detecting the command...

kindly go through the code and give your valuable suggestions solutions

 

thanks 

Download All
0 Kudos
Message 3 of 6
(2,550 Views)

You are waiting for a new client connection every loop iteration. Your wait for listener is insise the loop and so when a client connects you service the first message and then wait for another one.

 

Your code could also use some major cleanup. You should take a look at the LabVIEW Style Guide for advice on good coding practices. Also, it is not a good idea to have an event structure inside a timed loop. The event structure will gate your timing and defeat the purpose of a timed loop.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 4 of 6
(2,537 Views)

wait for listener is inside the loop but under a condition as when a error except 56 occurs it will wait to listen and generate a new connection id r else old connection id will he there for remaining tcp writes...actually in my requirement server will be always there to process clients request at any time so once i have executed server it will be running in between if client is closed and reopens and send command to it server should respond but in practically server is responding only frst command after that it is not receiving any command.

kindly give ur valuable suggestions ...

 

thanks

0 Kudos
Message 5 of 6
(2,518 Views)

It is hard for anyone to give comments on your code, as the code is hard to read. You need to do some clean up, before we can give more comments to your code.

 

And debugging a picture is even harder. Can you attach your cleaned up vi for your server AND client ?

Is there any other events in the Event structure other than the timeout ?

 

Is there any reason for you to use the Feedback Node instead of a shift register ?

 

You are also misusing local variables. DON'T use local variables when you can use the control/indicator directly.

 

And last, DON'T ever use the STOP vi. It is the same as using the Abort. This is not the correct way of stopping a program/vi. Any vi's/functions after the while loop will NEVER execute when you use the STOP vi.

0 Kudos
Message 6 of 6
(2,494 Views)