This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

tcp_close and tcp_abort doesn't work properly

Hi

I've used At91sam7x512 and keil sample codes for TCP connection but here is a kind of problem when I try to disconnect my board in my tcp_callback routine I'll get TCP_EVT_CLOSE condition and here I called tcp_close(soc)

when I use tcp_get_state before tcp_close the result is 10 (TCP_STATE_CONNECT) and after that it's 255 (!!!)

and if I wait for 2 or more minutes my tcp_callback have been called again but with TCP_EVT_ABORT condition.

during this time gap, I'm in listening mode but nobody can connect to my device.

below code is a part of my work and I used printf to get state of tcp in different positions:

case TCP_EVT_CLOSE:
printf("1:%d\r\n",tcp_get_state(soc));
tcp_close(soc);
tcp_release_cocket(soc);
printf("2:%d\r\n",tcp_get_state(soc));
initializetcp();
.
.
.
case TCP_EVT_ABORT:
printf("3:%d\r\n",tcp_get_state(soc));
tcp_abort(soc);
tcp_release_cocket(soc);
printf("4:%d\r\n",tcp_get_state(soc));
initializetcp();
.
.
.

and in initializetcp routine I try to get socket and listen. and I've used tcp_abort instead of tcp_close in TCP_EVT_CLOSE condition but they were the same and the problem was exist

and I've got such a result from hyperteminal:

1:10
2:255


(after 2 minute)

3:8
4:255

although when I try to close my program in PC there is no any problem but when my application program throw an exception such problem will occur.

what's going wrong here?

thanks in advance