NetworkStream.WriteByte(Byte) Method
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.
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)
Parameters
- value
- Byte
The byte to write to the stream.
Exceptions
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.
Remarks
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.
Applies to
反馈
https://aka.ms/ContentUserFeedback。
即将推出:在整个 2024 年,我们将逐步取消以“GitHub 问题”作为内容的反馈机制,并将其替换为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈