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
Are you talking about a correct TCP closure or a disconnection of a cable?
If you're talking about TCP closure, then the stack provides an event to tell you of it.
If you're talking about trying to detect when the cable has been disconnected (or cut), then the TCP protocol stack will not directly tell you of the event.
For example when an application connect to this device as a client if I try to close the connection in PC or close that application, my device doesn't show me anything. in the other worlds running and closing application in PC for two times will cause such problem.
these are the same in unplugging the cable or closing the connection by software.
anyway when the client be disconnected, the server's port is open and never be closed for a long while or forever.
No, it is not the same thing to close a TCP connection and to disconnect a network cable.
You just can't see a disconnected cable without trying to send data and notice the transfer failure.
So a TCP connection with KEEP_ALIVE will notice a disconnected cable, but a connection without may think it is connected days later.
One side actually closing a connection on the other hand means that the two TCP/IP stacks will talk with each other and make sure that both sides knows that the connection is getting closed.
If you connect using telnet to another computer somewhere, and the connection is unreliable, you can see that if you use KEEP_CONNECT, and go to bed, the connection will probably have disconnected in the morning. If you didn't use KEEP_CONNECT, it really doesn't matter if there is a link between the two machines until you try to press a key and your side notices that it fails to communicate.
I swear that there is no any difference between unplugging and closing port by software in my device. both of them take me a long time to detect.
I couldn't get you about KEEP_ALIVE, what is it?
I've used RL-ARM and I have just tcp_get_state to recognize the TCP status.
here per each received data packet in my device, I try to send a packet to client side, so there is no way to send a packet to detect TCP closure without any received packet.
would you please tell me more about this matter?
if here is an optimized and standard way to detect such a thing maybe I'd change my implementation policy.
thanks in advance
I swear that there is no any difference between unplugging and closing port by software in my device
NNNNNNNNNNNNNNNOOOOOOOOOOOOOOOOOOOOOOO
1. Listen to what you are told 2. Read about TCP/IP design philosophy and you will understand. 3. No near to swear here.
View all questions in Keil forum