NetworkStream.CanWrite Property


Gets a value that indicates whether the NetworkStream supports writing.

 virtual property bool CanWrite { bool get(); };
public override bool CanWrite { get; }
member this.CanWrite : bool
Public Overrides ReadOnly Property CanWrite As Boolean

Property Value

true if data can be written to the NetworkStream; otherwise, false. The default value is true.


If CanWrite is true, NetworkStream allows calls to the Write method. Provide the appropriate FileAccess enumerated value in the constructor to set the readability and writability of the NetworkStream.


The CanWrite property is set when the NetworkStream is initialized. Changes in the underlying Socket's state (eg. closure) do not affect the value of CanWrite.

Applies to

See also