NetworkStream.WriteByte(Byte) Method
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.
Writes a byte to the current position in the NetworkStream and advances the position within the stream by one byte.
public:
override void WriteByte(System::Byte value);
public override void WriteByte (byte value);
override this.WriteByte : byte -> unit
Public Overrides Sub WriteByte (value As Byte)
- value
- Byte
The byte to write to the stream.
The NetworkStream does not support writing.
An error occurred when accessing the socket.
-or-
There was a failure while writing to the network.
The NetworkStream is closed.
Note
Check to see if the NetworkStream is writable by calling the CanWrite property. If you attempt to write to a NetworkStream that is not writable, you will get an InvalidOperationException.
Note
If you receive an IOException, check the InnerException property to determine if it was caused by a SocketException. If so, use the ErrorCode property to obtain the specific error code and refer to the Windows Sockets version 2 API error code documentation for a detailed description of the error.
Product | Versions |
---|---|
.NET | Core 3.0, Core 3.1, 5, 6, 7, 8, 9 |
.NET Standard | 2.1 |
.NET feedback
.NET is an open source project. Select a link to provide feedback: