Editare

Partajați prin


NetworkStream.WriteByte(Byte) Method

Definition

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.

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