This is the mail archive of the
ecos-discuss@sourceware.org
mailing list for the eCos project.
Re: Re: __tcp_close() can't close connection in Redboot
On Wed, 2005-10-12 at 15:16 +0200, Andrew Lunn wrote:
> On Wed, Oct 12, 2005 at 07:55:11AM -0500, Grant Edwards wrote:
> > In gmane.os.ecos.general, you wrote:
> >
> > > I am trying to build up httpd service in RedBoot.
> > > And I met problem that I can't close connection by
> > > calling __tcp_close() after replying data to
> > > client,and the httpd sock state is always TIME_WAIT.
> >
> > Right.
> >
> > After you close a tcp connection (you send a FIN packet and
> > receive a FIN back) the state is _supposed_ to be TIME_WAIT.
> >
> > http://tangentsoft.net/wskfaq/articles/debugging-tcp.html
>
> The purpose of this is to catch old packets still floating around the
> network including retransmitted FIN packets.
>
> Normally this is not a problem. The server goes back to its listen
> socket and accepts the next connection. After 2x maximum segment
> lifetime the old socket in TIME_WAIT is destroyed.
>
> I don't know the redboot tcp stack. Does it implement the same
> concept? ie simply accept the next connection waiting on the listen
> socket?
RedBoot hangs once it sees the CLOSE_WAIT condition. You need to
continually call __tcp_poll() which will eventually flush the connection
which then goes to CLOSED. At that time, you can create a new
connection.
Note: this code is untested for more than one active TCP connection,
so beware.
--
------------------------------------------------------------
Gary Thomas | Consulting for the
MLB Associates | Embedded world
------------------------------------------------------------
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss