Re: TCP-IP questions

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

 



On Sun, 8 Jun 2003, Bryan K. wrote:

> I am implementing a server-client tcp-ip application and I would like to 
> know some things.
> 
> a) When read(2) returns, is it sure that the other side has recieved the 
> whole buffer passed to read(2)?

The other side would not be getting any data if you are reading from it.
If you are meaning 1 side calls write and you want to know when
this has arrived at the other side you can find out how much data is left 
in the send-q if it is 0 then you know it has reached the other computer
If you want to know if the program has read it then you can ack it
though your data stream.

> b) If i have a loop which write(2) one byte at each itteration, the kernel 
> sends many tcp packets each one containing one byte of userfull data?

It can do the tcp Push flag should be set on every call to read unless you
use socket options like TCP_CORK which will wait until it has
a packet to fill the MTU before sending it.

> c) An ACK is sent when the kernel receives a tcp packet or when a userspace 
> read(2) from the socket occurs?

The ack is sent wether or not read has been called on the socket.
If you watch the output of tcpdump until the read has happened you will 
see that the window size keeps getting smaller because the buffer on the 
other side is filling up.


--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux