ST-CS-10-339-75
March 2002

3.  RWIN  (U)

RWIN stands for Recieve WINdow.

When a computer sends a packet to another computer, the recieving computer, once the packet arrives, has to send an acknowledgement back to the sender so that the sender knows the packet arrived safely and was not lost somewhere in the network between the two computers (and therefore needs to be resent).

Consider a computer with a perfect 56k modem link to the network, using an MTU of 576 bytes, connected to a Half-life server with a ping of 150ms.

This computer can send 7.3 packets per second, if it is just throwing packets out onto the network as quickly as possible. (33600 bits per second for a perfect 56k modem uplink is 4200 bytes per second, divide that by 576 bytes per packet gives 7.3 packets per second).

Imagine, however, what would happen if the computer waited for the acknowledgement that a packet has been recieved before sending the next packet.

The computer would send a packet, wait 150ms for the packet to reach the server and then another 150ms for the acknowledgement to arrive. Each packet would be sent, and then the link to the ISP would be idle for 300ms, and then another packet would be sent. Instead of being able to send 7.3 packets per second, the computer can now only send 3.3 packets per second. (One packet takes 300ms, 1000ms in a second, 300/1000 = 3.3)

Clearly, the solution is not to wait for the acknowledgement, but rather to remember it is still required and to note when the acknowledgement is recieved. If it is not recieved after a given period of time (say, 30 seconds) then we assume the packet never reached its destination and needs to be resent.

RWIN is the number of packets which can be sent before the sender stops sending packets and waits for some acknowledgements to return from the reciever.

(Strictly speaking, RWIN is actually the size in bytes of the number of packets which can be sent before the sender has to wait for acknowledgements - e.g., if you want to permit 8 packets to be sent before waiting, and your MTU is 576, then RWIN is 8 * 576 = 4608).

If this value is set to equal MTU, then the computer behaves as described above, waiting for an acknowledgment after sending every packet. When playing Counter-Strike, it is assumed the link between the client and server is reliable and so RWIN needs to be set to a very high value to ensure that the client never stops sending data because it has been instructed to wait for some acknowlegements from the server - we are making the assumption the server is reciving all packets for the sake of performance.

A very high value would be 64 kilobytes, 65536.