SoSndBuf and SoRcvBuf Properties

Beginning with Chilkat v9.4.0, two new TCP socket performance properties, SoSndBuf and SoRcvBuf, will be added to each of the following Chilkat components/libs: FTP2, HTTP, SFTP, SSH, SshTunnel, IMAP, and MailMan (POP3/SMTP).

These properties allow for the underlying socket’s send and receive buffer sizes to be set. These are socket options associated with the setsockopt system call (see ) using the SO_SNDBUF and SO_RCVBUF options.

It is recommended that these socket options remain unchanged unless performance seems slow. If uploads seems slow, then set the SoSndBuf to a larger buffer size. It is recommended to use buffer sizes that are a multiple of 4096. The default buffer size varies from system to system. To get the value, examine the LastErrorText property after calling any Chilkat method that establishes a TCP connection. The socket’s send and receive buffer sizes will be reported.

Likewise, if downloads seem slow, set the SoRcvBuf to a larger value.

For more information about TCP performance, see these web pages:

Bind to Adapter Functionality on the Windows Platform

The following is a note from a Chilkat customer, reproduced with permission:

“Here is some info you might find interesting.

As you may know, we’ve run into strange problems while trying to use the ‘bind to adapter’ functionality (i.e. ClientIpAddress property) of Chilkat (HTTP and FTP).  On Windows 7 it worked fine, but on Windows XP it did not. The packets would go out on the wrong adapters, but contain the correct adapter’s IP in them, which led to communication failure.

After some research, we’ve found an article about the behavior of Bind on Windows XP vs. Windows 7. It turns out Windows XP uses a “Weak Host Model” while Windows Vista and above use a “Strong Host Model”. This is basically a security-related change that is part of the full rewrite of the TCP/IP stack in Windows Vista (Next Generation TCP/IP Stack).
If you’re interested in reading about this, here are two links:

To summarize what’s detailed in these articles – in the weak host model, the stack allows packets having any ip to be sent or received over a certain interface. In the strong host model, only packets with the IP belonging to the interface may be sent or received on it. Furthermore, in the weak host model Windows uses the routing table to decide which interface to use. This means that if you were to bind to a specific interface but the routing table indicates a different one, you would get packets going out of the second interface (indicated by the routing table) but using the IP of the first interface (indicated by bind) – in a normal network configuration (different ports connected to different networks) this will cause the communication to fail. On Windows 7 everything should behave as expected.”