Home/Support/Support Forum/HOW TO DETECT TCP/IP CABLE DISCONNECTION
Welcome to Digi Forum, where you can ask questions and receive answers from other members of the community.

HOW TO DETECT TCP/IP CABLE DISCONNECTION

0 votes
Hi Everybody

Have a problem in a simple TCP/IP app. My app is running as a passive server listening and accepting a TCP connexion.
The connexion is stablish and works well but I want to detect when the it goes down because of a cable disconnection.

I've been testing tcp-tick and socket-alive to see if they return 0 (zero) when the cable disconnect, but it seems that this mechanism doesn' t work. The socket continues establish, and tcp-tick returns 6.

So I guess that the tcp stack doesn't realize that the cable was disconnected. Is there any mechanism to detect when the other side is not there anymore??

Do anybody know how to detect this situation??? Because I need to go and listening again for a new tcp connection.

I guess that if the application on the other socket side goes down without closing the socket, the situation would be the same.

I' m using a rabbit 3700 and dynamic c 9,6

BR, Gustavo
asked Nov 18, 2008 in Rabbit by gbellora New to the Community (1 point)

Please log in or register to answer this question.

2 Answers

0 votes
Hi,
try this:
.
.
fEth = FALSE;
.
.
while(1){
loophead();
.
.
costate{
tcp_tick(NULL);
if(!pd_havelink(IF_DEFAULT) && fEth){
dhcp_release();
fEth = FALSE;
}
if(pd_havelink(IF_DEFAULT) && !fEth){
dhcp_acquire();
fEth = TRUE;
}
}
.
.
}


fEth == true when connected, false otherwise,

This works just fine for us.
Cheers,
Martin
answered Nov 27, 2008 by mfuhrer New to the Community (4 points)
0 votes
Hi Martin

Thanks for your reply.
I'll test it

I didn't know about pd_ functions.
There's lot of functions to learn and it' s difficult to manage all of them when your' re not all the day with this kind of developments

BR, Gustavo
answered Dec 1, 2008 by gbellora New to the Community (1 point)
...