Hi
I'm using AT91sam7x512 with DP83848 for Ethernet connection and in my project device is set as host, and every thing is OK except TCP closed detection.
I've used tcp_get_state() to determine which state my device is. but it's really unreliable and maybe after 10 minute I could detect that the connection was lost and sometimes never I could.
my cable connected to the PC through Ethernet switch and I've set timeout to 120.
in configuration of DP83848 I've used auto negotiation mode to connect and there's not any difference between auto neg. and fixed mode(100BT or something else)
Does anybody have suggestion?
if you could help, I'd appreciate you.
thanks
"...add tcp_abort() to TCP_EVT_ABORT and TCP_EVT_CLOSE"
Is not necessary (and I think is just plain wrong, since there are limitations to the calls you can make to TCPnet from within the callback function).
"and I tried to add keep alive here because if the keep alive be separated form this loop maybe TCP get crashed."
You do not need to add explicit code to transmit the 'keep alive' - TCPnet (if configured to do so) will do it automatically. Besides which, as far as I am aware, the keep alive cannot be created by simply sending a zero byte TCP block.
I think you should spend more time reading the manual(s).
with that method which I said, it is fine. every thing is OK.
and without tcp_abort the system can not connect to new port.(system will set to listening state but I've got timeout error if I don't do such a thing)
and about keep alive with zero length packet is not bad because I could recognize closure of TCP port. and it is just 10 seconds after the latest received packet because my system will send at least one packet per each second.
Is there any wrong thing which is mentionable?
because the system is under test and I need to make it reliable enough.
"Is there any wrong thing which is mentionable?"
It seems you must be using a different TCPnet to the one I recognise.
"and about keep alive with zero length packet is not bad because I could recognize closure of TCP port. and it is just 10 seconds after the latest received packet because my system will send at least one packet per each second."
If you're going to send at least one packet per second, why do you need a keep alive packet each 10 seconds?
"...I need to make it reliable enough."
You better do some serious studying.