lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-users] closing a connection in raw mode


From: Siva Velusamy
Subject: [lwip-users] closing a connection in raw mode
Date: Mon, 10 Dec 2007 13:54:55 -0800

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]