07-07-2006 11:39 AM
07-07-2006 01:10 PM
Ken
Big assumption here that you are using windows. I don’t have a great deal of experience with TCP so this is just and idea, which I think will work as I have done something similar, under Linux.
I ran the example Simple Data Server and Client VI’s from the Example finder. I then started up a command window (cmd.exe) and executed these commands and this was the results.
C:\TEMP>netstat -an > netstat.txt
C:\TEMP>find "2055" netstat.txt
---------- NETSTAT.TXT
TCP 0.0.0.0:2055 0.0.0.0:0 LISTENING
TCP 127.0.0.1:1113 127.0.0.1:2055 ESTABLISHED
TCP 127.0.0.1:2055 127.0.0.1:1113 ESTABLISHED
C:\TEMP>netstat -an > netstat.txt
C:\TEMP>find "2055" netstat.txt
---------- NETSTAT.TXT
C:\TEMP>
The first netstat snapshot was taken while the server and client we running. The second
netstat was after I stop the client which in turn kills the server.You can see that the
netstat commands show the ESTABLISHED status on Port 2055 so this could be your test. Otherwise your server would only be LISTENING if the GPRS module dropped the connection.The second
netstat and don’t find any connection on port 2055.If you think this would work for you then you could build a polling script using the System Exec.vi to execute the
netstat and the find commands.David
07-07-2006 02:52 PM - edited 07-07-2006 02:52 PM
Usually this is done in the server. In the server you should have a loop that keeps polling the connection(s) for incoming commands with TCP Read. If you do this with a timeout of 0 seconds you can actually serve several connections in the same loop without having to resolve to one independant deamon per connection. This read function will either return with data or with an error. The error itself is the interesting part. Mostly this will be 56 (timeout error) and of course should be ignored. Any other error would indicate something has gone wrong with the connection and you probably should close the connection at your end as soon as possible (don't wire in the error cluster from the read function into the close function since you want to close the connection always on error.
@Ken Kearney wrote:Dear All,I use a GPRs module to connect to a labview tcp server. Sometimes the module disconnects from the server and the server doesn't notice that the connection has shut down. Is there any way I can check for a connection that has shut down? How can I check that the TCP connections that Labview thinks are open are really open?
Message Edited by rolfk on 07-07-2006 09:57 PM
07-10-2006 02:07 AM - edited 07-10-2006 02:07 AM
Message Edited by devchander on 07-10-2006 02:08 AM
04-02-2007 07:06 AM
Ken
how do you use LV to connect GPRS and TCP/IP? could you tell me? I try three all days and still not work.
thanks a lot
PatchChen
04-02-2007 01:45 PM
LabVIEW is not in the picture here at all. What you need is a mobile network provider that can tell you how to setup your network configuration for the OS your are using. In the past this has been proven to be a major hurdle with tech support telling me that since I wasn't using the specific Windows version they were using it couldn't work. Basically it does work with just about any Windows version down to NT4.0.
@patchchen wrote:
Ken
how do you use LV to connect GPRS and TCP/IP? could you tell me? I try three all days and still not work.
thanks a lot
PatchChen
04-02-2007 02:48 PM
04-03-2007 07:28 AM
01-25-2008 06:26 AM
@rolfk wrote:
Usually this is done in the server. In the server you should have a loop that keeps polling the connection(s) for incoming commands with TCP Read. If you do this with a timeout of 0 seconds you can actually serve several connections in the same loop without having to resolve to one independant deamon per connection. This read function will either return with data or with an error. The error itself is the interesting part. Mostly this will be 56 (timeout error) and of course should be ignored. Any other error would indicate something has gone wrong with the connection and you probably should close the connection at your end as soon as possible (don't wire in the error cluster from the read function into the close function since you want to close the connection always on error.
@Ken Kearney wrote:
Dear All,I use a GPRs module to connect to a labview tcp server. Sometimes the module disconnects from the server and the server doesn't notice that the connection has shut down. Is there any way I can check for a connection that has shut down? How can I check that the TCP connections that Labview thinks are open are really open?
There is a small chance that you won't see any other error than timeout eventhough the connection has been dropped somehow by the client. This can happen if the disconnect handshake in the TCP IP protocol gets hung somewhere. I've seen this with certain network hardware when the cable was disconnected. The only way to resolve this is by requesting the client to always send some sort of heartbeat message that needs to be acknowlegded by the server too. If the server then does not receive a message for a connection for some time you want to disconnect that connection too on your side (and the client should disconnect too after not receiving an acknowledgment for its messages for a certain time).
Rolf Kalbermatter
Message Edited by rolfk on 07-07-2006 09:57 PM
I am doing a connection to another TCP server with my VI client, is it possible to get the VI register if the connection is somehow lost, e.g. if the server has crashed or the cable has been unplugged without sending this heartbeat signal? If I have to send this heartbeat signal, the server will have to be able to register this signal too? I am not able to make the server handle this signal because it is remote, therefore I cannot change the serverprogram.
Simon Bøgh
01-25-2008 08:26 PM
@SCMAJA wrote:
I am doing a connection to another TCP server with my VI client, is it possible to get the VI register if the connection is somehow lost, e.g. if the server has crashed or the cable has been unplugged without sending this heartbeat signal? If I have to send this heartbeat signal, the server will have to be able to register this signal too? I am not able to make the server handle this signal because it is remote, therefore I cannot change the serverprogram.Simon Bøgh