LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

tcp/ip timeout problem- client/server

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..

Download All
0 Kudos
Message 11 of 25
(1,484 Views)

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.



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
Download All
Message 12 of 25
(1,476 Views)

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?

 

 

 

0 Kudos
Message 13 of 25
(1,465 Views)

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.



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 14 of 25
(1,448 Views)

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..

0 Kudos
Message 15 of 25
(1,438 Views)

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

0 Kudos
Message 16 of 25
(1,432 Views)

hi mike! thanks again...

I have tried your suggestion, but somehow not able to manage it..

Can you try on my vi...

Download All
0 Kudos
Message 17 of 25
(1,426 Views)

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.

Vinal Gandhi, CLA
Message 18 of 25
(1,422 Views)

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.



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 19 of 25
(1,411 Views)

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?

0 Kudos
Message 20 of 25
(1,397 Views)