From 11:00 PM CST Friday, Feb 14th - 6:30 PM CST Saturday, Feb 15th, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From 11:00 PM CST Friday, Feb 14th - 6:30 PM CST Saturday, Feb 15th, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
09-21-2012 04:09 AM
Hi all,
Is there any method to check whether TCP connection is lost ? Actually in my program server may need to read the data for 44 minutes & i want to know that while reading say after 20 minutes connection is lost for unknown reasons. In that condition i should make sure that connection is estalished / lost. If in between this happens than i should inform user the same.
Any implementation of this type.
09-21-2012 09:41 AM
@Ranjeet_Singh wrote:
Hi all,
Is there any method to check whether TCP connection is lost ? Actually in my program server may need to read the data for 44 minutes & i want to know that while reading say after 20 minutes connection is lost for unknown reasons. In that condition i should make sure that connection is estalished / lost. If in between this happens than i should inform user the same.
Any implementation of this type.
There is no direct method other than the results of transmitting/receiving data. If you get an error 66 that would indicate that the connection has been closed by the other side. However, you will not get this until you try to send/receive data. If you are receiving data continuously you can looki for a timeout error (error 56). You may also get an error 52. The end result is that you need to check the error codes and then take whatever action you deem necessary.
09-22-2012 12:30 AM
See i also got this idea but what happens if during transmission if network connection is lost than also it will be connected to netowork so it wont show the ERROR 66(This i verified by myself)
As the other solution i cant send any data while i am receiciving the data i.e. inbetween read i cant write data. That is just not possible.
Timeout error is not possible because this is running on the server so input to timeout will be -1. for checking the validity of connection i can check the error(Whether error occured or not) but only when the program terminates but unfortunatelly its not teminating.
09-22-2012 05:22 PM
Hi,
Error 56 indicates connection timeout but your connection is there. Error 66 Indicates Connection lost. So for this you can make a case structure and on error 0 and 56 dont do anything just keep code running rest all error close the connectiona and try to reconnect your network connection.
09-22-2012 11:51 PM - edited 09-22-2012 11:54 PM
Hi Himashu,
See if the program is still reading the data & if i am connected the error handler after read than untill & unless it wont complete the read operation it wont come here. So can you please tell me implemetation wise what exactly you are suggesting. & this program is in while loop so it will always try to reconnect if everything goes wrong.
09-23-2012 12:42 AM
Hi Ranjeet,
Share your developed code so we can have a look and implement the modifications.
09-23-2012 01:19 AM
Hey himanshu,
I cant send you the code but i can send you the snapshot of that. This is just the abstract one. Please ask if u have any doubt. I tried to explain in the snapshot as much i thought it required. I tried to keep the code as simple as i can
09-23-2012 04:24 AM
Hello Ranjeet,
Here you can see this example I posted earlier for folder sync. Over TCP/IP. Just try to implement same in your code use send and receive TCP VIs.
09-23-2012 04:31 AM
I will check that. Hope this is what i was expecting. Will hear soon from my side.
09-23-2012 05:31 AM
Can you please help me to understand the code & how it gonna help me.