[Top][All Lists]

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

Re: [lwip-users] lwip_close

From: Atte Kojo
Subject: Re: [lwip-users] lwip_close
Date: Fri, 26 Aug 2005 11:07:27 +0300
User-agent: KMail/1.8.2

On Friday 26 August 2005 08:32, Ashutosh Srivastava wrote:
> Now, let me describe the problem I am facing because of this. The server
> I am connecting to is a shoutcast Internet radio server which streams MP3
> data over HTTP. When I close the connection, lwip sends a FIN segment
> and comes out. I am not sure why, but the server sends the FIN ACK after
> a long time and keeps on sending some more MP3 packets. 

Unfortunately, the server does nothing illegal here. A TCP connection is 
full-duplex and both directions work (and must be closed) independently. 
Quoting from Stevens' 'TCP/IP Illustrated Volume I':
"The receipt of a FIN only means there will be no more data flowing in that 
direction. A TCP can still send data after receiving a FIN".

> So, in between 
> if want to connect to the same server again, it fails because the server is
> still
> sending over the MP3 data for the previous connection and does not get the
> SYN ack. 

This seems pretty strange. Could you provide more details about what you are 
doing when the connection establishment fails.

> Another observation is that, the server itself does not send the 
> FIN segment, but the lwip timesout itself and deallocates the connection.

This is expected as lwIP closes both directions of the connection, but the 
server still has its side open.

> That's why I thought that connection should be closed only when the ACK is
> received and a FIN is sent from the server.
> Is there an alternative method to handle this?

The socket layer has a way to handle half-closed connections using the 
shutdown() function, but lwIP doesn't have a proper implementation of it 
(lwip_shutdown() just calls lwip_close()).

        - Atte

reply via email to

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