NetworkStream::Writeable Property
Gets a value that indicates whether the NetworkStream is writable.
Assembly: System (in System.dll)
Property Value
Type: System::Booleantrue if data can be written to the stream; otherwise, false. The default value is true.
You must derive from the NetworkStream class to use the Writeable property. If Writeable is true, NetworkStream allows calls to the Write method. You can also determine whether a NetworkStream is writable by checking the publicly accessible CanWrite property.
The Writeable property is set when the NetworkStream is initialized.
In the following code example, the CanCommunicate property checks the Writeable property to determine if the NetworkStream is writable.
#using <System.dll> using namespace System; using namespace System::Net; using namespace System::Net::Sockets; ref class MyNetworkStream_Sub_Class: public NetworkStream { public: MyNetworkStream_Sub_Class( System::Net::Sockets::Socket^ socket, bool ownsSocket ) : NetworkStream( socket, ownsSocket ) { } property bool IsConnected { // You can use the Socket method to examine the underlying Socket. bool get() { return this->Socket->Connected; } } property bool CanCommunicate { bool get() { if ( !this->Readable | !this->Writeable ) { return false; } else { return true; } } }
Available since 1.1