Condividi tramite


ServerSocket.ReceiveBufferSize Property

Definition

Gets the value of the SocketOptions#SO_RCVBUF SO_RCVBUF option for this ServerSocket, that is the proposed buffer size that will be used for Sockets accepted from this ServerSocket. -or- Sets a default proposed value for the SocketOptions#SO_RCVBUF SO_RCVBUF option for sockets accepted from this ServerSocket.

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 ServerSocket, that is the proposed buffer size that will be used for Sockets accepted from this ServerSocket.

Note, the value actually set in the accepted socket is determined by calling Socket#getReceiveBufferSize().

Added in 1.4.

Java documentation for java.net.ServerSocket.getReceiveBufferSize().

Property setter documentation:

Sets a default proposed value for the SocketOptions#SO_RCVBUF SO_RCVBUF option for sockets accepted from this ServerSocket. The value actually set in the accepted socket must be determined by calling Socket#getReceiveBufferSize() after the socket is returned by #accept().

The value of SocketOptions#SO_RCVBUF SO_RCVBUF is used both to set the size of the internal socket receive buffer, and to set the size of the TCP receive window that is advertized to the remote peer.

It is possible to change the value subsequently, by calling Socket#setReceiveBufferSize(int). However, if the application wishes to allow a receive window larger than 64K bytes, as defined by RFC1323 then the proposed value must be set in the ServerSocket <B>before</B> it is bound to a local address. This implies, that the ServerSocket must be created with the no-argument constructor, then setReceiveBufferSize() must be called and lastly the ServerSocket is bound to an address by calling bind().

Failure to do this will not cause an error, and the buffer size may be set to the requested value but the TCP receive window in sockets accepted from this ServerSocket will be no larger than 64K bytes.

Added in 1.4.

Java documentation for java.net.ServerSocket.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.

Applies to