Socket.ReceiveBufferSize Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets the value of the SocketOptions#SO_RCVBUF SO_RCVBUF
option
for this Socket
, that is the buffer size used by the platform
for input on this Socket
. -or- Sets the SocketOptions#SO_RCVBUF SO_RCVBUF
option to the
specified value for this Socket
.
public virtual int ReceiveBufferSize { [Android.Runtime.Register("getReceiveBufferSize", "()I", "GetGetReceiveBufferSizeHandler")] get; [Android.Runtime.Register("setReceiveBufferSize", "(I)V", "GetSetReceiveBufferSize_IHandler")] set; }
[<get: Android.Runtime.Register("getReceiveBufferSize", "()I", "GetGetReceiveBufferSizeHandler")>]
[<set: Android.Runtime.Register("setReceiveBufferSize", "(I)V", "GetSetReceiveBufferSize_IHandler")>]
member this.ReceiveBufferSize : int with get, set
Property Value
the value of the SocketOptions#SO_RCVBUF SO_RCVBUF
option for this Socket
.
- Attributes
Exceptions
Remarks
Property getter documentation:
Gets the value of the SocketOptions#SO_RCVBUF SO_RCVBUF
option for this Socket
, that is the buffer size used by the platform for input on this Socket
.
Added in 1.2.
Java documentation for java.net.Socket.getReceiveBufferSize()
.
Property setter documentation:
Sets the SocketOptions#SO_RCVBUF SO_RCVBUF
option to the specified value for this Socket
. The SocketOptions#SO_RCVBUF SO_RCVBUF
option is used by the platform's networking code as a hint for the size to set the underlying network I/O buffers.
Increasing the receive buffer size can increase the performance of network I/O for high-volume connection, while decreasing it can help reduce the backlog of incoming data.
Because SocketOptions#SO_RCVBUF SO_RCVBUF
is a hint, applications that want to verify what size the buffers were set to should call #getReceiveBufferSize()
.
The value of SocketOptions#SO_RCVBUF SO_RCVBUF
is also used to set the TCP receive window that is advertized to the remote peer. Generally, the window size can be modified at any time when a socket is connected. However, if a receive window larger than 64K is required then this must be requested <B>before</B> the socket is connected to the remote peer. There are two cases to be aware of: <ol> <li>For sockets accepted from a ServerSocket, this must be done by calling ServerSocket#setReceiveBufferSize(int)
before the ServerSocket is bound to a local address.</li> <li>For client sockets, setReceiveBufferSize() must be called before connecting the socket to its remote peer.</li></ol>
Added in 1.2.
Java documentation for java.net.Socket.setReceiveBufferSize(int)
.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.