Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]
Reads data from the NetworkStream.
Namespace: System.Net.Sockets
Assembly: System (in System.dll)
Syntax
'Declaration
Public Overrides Function Read ( _
buffer As Byte(), _
offset As Integer, _
count As Integer _
) As Integer
public override int Read(
byte[] buffer,
int offset,
int count
)
public:
virtual int Read(
array<unsigned char>^ buffer,
int offset,
int count
) override
abstract Read :
buffer:byte[] *
offset:int *
count:int -> int
override Read :
buffer:byte[] *
offset:int *
count:int -> int
public override function Read(
buffer : byte[],
offset : int,
count : int
) : int
Parameters
- buffer
Type: array<System. . :: . .Byte> [] () [] []
An array of type Byte that is the ___location in memory to store data read from the NetworkStream.
- offset
Type: System. . :: . .Int32
The ___location in buffer to begin storing the data to.
- count
Type: System. . :: . .Int32
The number of bytes to read from the NetworkStream.
Return Value
Type: System. . :: . .Int32
The number of bytes read from the NetworkStream.
Remarks
This method reads data into the buffer parameter and returns the number of bytes successfully read. If no data is available for reading, the Read method returns 0. The Read operation reads as much data as is available, up to the number of bytes specified by the count parameter. If the remote host shuts down the connection, and all available data has been received, the Read method completes immediately and return zero bytes.
Note
Check to see if the NetworkStream is readable by calling the CanRead property. If you attempt to read from a NetworkStream that is not readable, you will get an IOException.
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see dd66cd4c-b087-415f-9c3e-94e3a1835f74.