On Solaris, attempts to set the SO_SNDBUF/SO_RCVBUF socket options cause the buffer size to be clamped by the value of the tcp_max_buf/udp_max_buf parameters. This code no longer works on Solaris 11 (see 6984182). As an initial fix for this issue, this bug proposes:
1. First attempt setsockopt with the original buffer size and only clamp the value if it fails because the value exceeds the system limit.
2. Change the fallback limit to 1MB for tcp, and 2MB for udp. Currently it falls back to a limit of 64k if the values of tcp_max_buf/udp_max_buf cannot be obtained. If the fallback limits are changed to 1MB for tcp, and 2MB for udp then it reduces the problem in 6984182 to only the case where these parameters have been changed (which should be rare).