01-12-2011 04:55 AM
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.
01-12-2011 04:59 AM
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.
01-12-2011 05:13 AM
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...
01-12-2011 06:13 AM
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
01-12-2011 06:35 AM
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.
01-12-2011 06:44 AM
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
01-12-2011 06:48 AM
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.......
01-12-2011 09:24 AM
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.
01-12-2011 11:25 PM
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?
01-13-2011 12:17 AM
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