TCP receive window and congestion window - tcp

I am trying to understand TCP's advertised receive window size and how CUBIC congestion control works.
Can we set the initially advertised receive window size ? I tried setting SO_RCVBUF, but didn't affect.
What can change the advertised receive window during transmission - what actions/events will affect the receive window size ?
What is the relation between congestion control and receive window size?
I am using Linux 3.11.

Can we set the initially advertised receive window size ? I tried setting SO_RCVBUF, but didn't affect.
It does. You must have done it wrong. You have to set it before connecting the socket, or, in the case of a server, on the listening socket, from which all accepted sockets will inherit it. Setting it after the connect doesn't work if window scaling is required, as that is only negotiated durimg the connect handshake.
What can change the advertised receive window during transmission - what actions/events will affect the receive window size ?
Reading from the socket.
What is the relation between congestion control and receive window size?
Nil.

Related

How to increase TCP window size

I am working on a video streaming server which streams video at 6Mbps rate. When checked through Wireshark, I noticed that the window size does not go above 3100 or so. For testing purpose, I connected an IP Camera and checked window size. For this, I found that the window size is approximately 6100.
I increased the send buffer size of my application's TCP socket. But, no luck. It actually reduced the window size to 1560 or so. Any suggestion on how to increase the window size.
My application's target recipient is a device on LAN.
I increased the send buffer size of my application's TCP socket. But, no luck. It actually reduced the window size to 1560 or so.
The receive window size is controlled by the receive socket buffer size on the reciever.

Change Asterisk chan_mobile packets size

When call is made between two chan_mobile channels, all works fine.
But not when call is established between SIP and chan_mobile (through simple bridge).
SIP -> mobile is clear and fine with controllable packet size in sip.conf
Reverse direction voice going in too small packets causing near 180 kbits/s and loosing packets because of out of order on SIP phone side (if not enabled permissive mode on RTP).
So question is how to increase packets size originated by chan_mobile and going to SIP?
Setting like
allow=ulaw:100
not works in chan_mobile.conf
Chan mobile to chan_sip connection is via sln internal bridge ALWAYS.
You can control only outgoing packets(from your server sip to remote sip) by set
allow=g729:20
Or similar form. Please note, that codec should support length of packet you asking.
You have no any way control other side, so no way control inbound direction.
For more info see https://wiki.asterisk.org/wiki/display/AST/RTP+Packetization

TcpWindowSize vs Socket Buffer Size on Windows

What is difference between TcpWindowSize and Socket Buffer Sizes ?
I assume TcpWindowSize can be changed only using Registry Settings and Socket Buffer Sizes can be changed using SO_SNDBUF and SO_RCVBUF socket parameters?
The TcpWindowSize Registry setting controls the maximum advertised window of the interface as described in the MSDN link. Being a Registry setting, you change it in the Registry.
SO_RCVBUF controls the size of the socket receive buffer. This is the maximum advertised TCP window of the connection, and it is evidently subject to overriding by (1).
SO_SNDBUF controls the size of the socket send buffer. It doesn't have anything directly to do with windowing.

TCP or UDP for image transfer

I'm using lwip stack on my embedded platform. I have connected the board to my PC via ethernet. My application running on board, dumps the image data out of ethernet. PC applications waits for header, after header it decodes the data and displays the image.
This is for debug purpose only. My images are 4MBytes and i receive 20 Frames per second. So it will be 80MBytes data per second.
Is is advisable to use TCP or UDP?
I tried using TCP, but my send buffers becomes full and it will wait around 200ms to receive acknowledge. Mean time i loose 5-6 images coming from sensor. Can this be fixed if i use UDP?
Thanks,
Sathya
I suggest you apply some kind of compression to your images before sending them to the network.
That said, if you use UDP, you may get better transferrate, but you do need receiving code that can handle lost packets (discard image or request resend or pad affected area)

How can I retrieve current TCP congestion window size from the kernel? Any command or simple script?

Is there any command or script to retrieve the current TCP congestion window of a tcp connection. So suppose some communication is going on over tcp through the network interface (eg. eth0), now is there any way to dynamically (periodically) retrieve the tcp congestion window?(in Linux platform)
Is there any command or script to retrieve the current TCP congestion window of a network interface?
No, because there isn't any such thing. Network interfaces don't have congestion windows. Connections do.
I recommend you to try tcpprobe. By dynamic load tcpprobe, you can get the congestion window size.
http://www.linuxfoundation.org/collaborate/workgroups/networking/tcpprobe

Resources