Re: close() on tcp socket.

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


ratheesh kannoth wrote:

> connect() system call establishes a connection as shown in below steps.
> 
> 1.   |client |  ----------------- syn --------------->  | server |
> 
> 2.  |Server|  --------------syn+ ack --------------> | client |
> 
> 3.  | Client | -----------------ack --------------------> | Server |
> 
> 
> But establishing connection , client calls close() system call. Client
> is sending FIN+ ACK to server  [ i expected only FIN to be sent from
> client to server ]

Every TCP packet except the initial SYN-only packet includes an ACK. 
The ACK flag simply indicates that the acknowledgement number field is
valid. Once a host has received at least one packet, any packets which
it sends will always have a valid acknowledgement number and so the
ACK flag will be set.

When the client sends the initial SYN packet to create the connection,
it hasn't received any packets from the server, so it cannot
acknowledge anything. This packet (including any retransmissions of
it) is the only case where the ACK flag will be clear.

> Is this a valid scenario.?  what could be the problem ?

There is no problem.

-- 
Glynn Clements <glynn@xxxxxxxxxxxxxxxxxx>
--
To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Linux Assembler]     [Git]     [Kernel List]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [Yosemite Campsites]     [Yosemite News]     [GCC Help]

Add to Google Powered by Linux