LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

tcp/ip timeout problem- client/server

Hi to all!!!

I am using tcp/ip simple client/server vi to communicate through network.

My problem is the "timeout" feature of "TCP Listen.vi"...I want my server vi to run without having timeout condition to client vi....I mean client can anytime run his vi and see the data sent by server at his comfort.....I want to eliminate this timeout feature ....how to do that?????

Thanks in advance.

0 Kudos
Message 1 of 25
(5,184 Views)

If I have understood the question correctly:

Have a look at the context help window (Ctrl + H), and will notice that if you want to wait forever, then input -1.

Adnan Zafar
Certified LabVIEW Architect
Coleman Technologies
Message 2 of 25
(5,180 Views)

thanks Adnan for your help, you right  when I put -1 or no value it waits forever but my server vi does not collect data meanwhile...it just stuck and waits for client to start its vi....I want such that my server vi runs without interrupt and client can come any time and start the communication... 

0 Kudos
Message 3 of 25
(5,170 Views)

Hi MSD100,

can you explain it please? What should the server do?

 

You can wait for a connection and acquire data from a daqmx card in parallel. There is an example about it in the example finder. You'll find it if you search for tcpip.

 

Mike

0 Kudos
Message 4 of 25
(5,162 Views)

Hi Mike. Thanks for your reply.

 

My server vi is collecting data and updating continuously and running on one pc....client is on different pc connected in a network....I have used simple client/server vi to send data of server to client....now my problem is I want my client to log in any time he wants and see the data at his leisure and monitor what is current situation at server side....now in the server vi we have "tcp listen vi" we have timeout feature which waits for particular time(set by user) before client start his vi....I want this to eliminate completely as I don't want any timebound between client/server.....

I hope I have explained it correctly.....

thanks.

0 Kudos
Message 5 of 25
(5,157 Views)

Hi MSD100,

the timeout problem should be solved with the "-1". The part i don't understand is where you have problems now? Is it with the parallel tasks?

You can use your "normal" code to acquire your data and there you add the TCP Server part. Both tasks have to run in parallel. As i said, the example shows how you can handle it. There is one loop which comunicates with all connected clients and another loop which handles new connections. I think that is how you can do it.

 

Mike

0 Kudos
Message 6 of 25
(5,153 Views)

thanks mike,

I will see the example...parallel task seems answer for that but still I don't know how to do that ...I will see the example and then reply.......

0 Kudos
Message 7 of 25
(5,148 Views)

The simplest way is to create two while loops on the block diagram. Don't put one loop inside the other, they should be next to each other. Put the code you want to have in one task in one loop and the code for teh second in the other loop. You now have parallel tasks. You will need to be able to have a stop condition that will stop both loops when you want to exit.



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 8 of 25
(5,135 Views)

hi mike...thanks again...

I created two parallel loops as you said...it works fine but one problem is there....as I said two parallel while loops are there with separate stop button...so when I start vi both are starting.... when I stop the my other code while loop it stops but my tcp vi does not stop even I stop the button because it is in the forever state...so it does not reach that button until the client initiate for once atleast....I just want to exit this forever state from server side.whenever server wants... 

 

how to terminate that forever state from tcp listen vi?

0 Kudos
Message 9 of 25
(5,113 Views)

Hi MSD100,

you can close the connection of the listener after the first loop. Use the occured error to stop the second loop. Attached is an image with shows an example of it.

 

Hope it helps.

Mike

Message 10 of 25
(5,106 Views)