Hello -

Could anyone point me to the correct way to close a connection using
tcp_close in RAW mode?

Currently, I have a snippet like the following in my receive callback function:

      if (pcb->state >= FIN_WAIT_1 && pcb->state <= CLOSING) {
                tcp_close(pcb);
                return;
      }

I don't like the fact that the application is probing into the PCB
structures..But then again, this is raw mode, so it might be ok. Any
thoughts?

Initially I only checked if pcb->state > ESTABLISHED, but that ended
up calling tcp_close twice under certain circumstances, and as I found
out after a long debugging session, you don't want to close a socket
that has already been closed since that will lead to wierd memory
corruption issues depending on the sequence of packets received.

Thanks,
Siva
-- 
In the end, everything is a gag.
           Charlie Chaplin


_______________________________________________
lwip-users mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/lwip-users

Reply via email to