01-13-2011 03:35 AM - edited 01-13-2011 03:39 AM
hi mike........
I have tried your suggestion but somehow not able to manage what I want..
I am attaching the vi's with some modification suggested by you...but not successful .......can you try on this vi..
01-13-2011 09:55 AM
Here are some working versions. This may not be exactly what you are looking for. However, your version had the server continually posting the data even when it didn't changed. It did this at an incredibly fast pace. I modified it to only send the data when changed. You do have to change the data before it sends anything. I also cleaned up the way the applications exit. If you want to send data faster you could or have it send continuously you can. I made this change because you could not tell that the reader was seeing the new values. Too many copies of the same data were posted to the queue to see the change.
Anyway, the basics of the client server are working Exactly what data and when you want to send it would be dependent on your application.
01-16-2011 10:48 PM
hi Mark! Thanks for reply.
I have tried vi posted by you. certainly it has improved....but one thing still make me uncomfortable.
case 1: When I start server vi and then stop it without opening client vi it is not being stop(using stop button on front panel -- but stops using abort on toolbar)....
case 2: when I start server vi then start client vi and then stop , it stops with this error attached in the picture...
Is this normal?
01-17-2011 11:44 AM
The issue with #1 is that the server is stuck waiting for a client to connect. There is no timeout on the wait so it that deosn't detect the stop. If you want to do that you would have to place the TCP Wait on Listener VI in a loop, use a timeout value so the wait will timeout allowing you to check if the application was stopped before a connection was made.
The answer to number 2 is yes, this is normal behavior. The server applications uses the "Release Queue" to signal the lower loop to exit. I didn't filter the error so you see it when the general error handler is called. You could clear the error in the error case of the lower loop when you receive this error.
01-17-2011 10:30 PM
Is there any alternative to solve issue #1 without using timeout bound....is there anything to put externally so that it can be get out from being stuck...
Thanks..
01-18-2011 01:53 AM - edited 01-18-2011 01:54 AM
Hi MSD100,
there is another solution. If you close the listener refnum, then the listener stops with an error. You can see how it should work in the image from my previous post.
Mike
01-18-2011 02:39 AM
hi mike! thanks again...
I have tried your suggestion, but somehow not able to manage it..
Can you try on my vi...
01-18-2011 06:59 AM
Hi MSD100,
Refer this attachment.
first run RT_TCP/IP Main VI which will run continuosly without error.
when you want to connect Host Connection then run Host_TCP/IP Main Vi which will automatic connect to RT TCP/IP & transfer the data very easily.
This is the best solution you should try it.
01-18-2011 02:19 PM
Here is a revised server that handles most errors. In addition, it will go back to waiting for a connection after the client disconnects. I'm not happy with doing the read on th econnection in the server to determine if teh connection has been closed. I am still looking for a better way to simply check the status of the connection.
01-19-2011 12:56 AM
hi Vinal! thanks for reply.
It still not the solution I am looking for...If you put -1 in timeout...it doesn't stop from front panel in case of no client connection.
I am trying differently now...
I am wondering that if I can start polling for client in each iteration of my while loop in my main code with some milisecond timeout...does it sound ok?