Provides the underlying stream of data for network access.
Public Constructors | |
| network_stream (const xtd::net::sockets::socket &socket) | |
| Creates a new instance of the network_stream class for the specified xtd::net::sockets::socket. | |
| network_stream (const xtd::net::sockets::socket &socket, bool owns_socket) | |
| Initializes a new instance of the xtd::net::sockets::network_stream class for the specified xtd::net::sockets::socket with the specified xtd::net::sockets::socket ownership. | |
| network_stream (const xtd::net::sockets::socket &socket, xtd::io::file_access access) | |
| Initializes a new instance of the network_stream class for the specified xtd::net::sockets::socket with the specified access rights. | |
| network_stream (const xtd::net::sockets::socket &socket, xtd::io::file_access access, bool owns_socket) | |
| Initializes a new instance of the network_stream class for the specified xtd::net::sockets::socket with the specified access rights and the specified xtd::net::sockets::socket ownership. | |
Public Properties | |
| auto | can_read () const noexcept -> bool override |
| Gets a value indicating whether the current stream supports reading. | |
| auto | can_seek () const noexcept -> bool override |
| Gets a value indicating whether the current stream supports seeking. | |
| auto | can_timeout () const noexcept -> bool override |
| Indicates whether timeout properties are usable for xtd::net::sockets::network_stream. | |
| auto | can_write () const noexcept -> bool override |
| Gets a value indicating whether the current stream supports writing. | |
| virtual auto | data_available () const -> bool |
| Gets a value that indicates whether data is available on the xtd::net::sockets::network_stream to be read. | |
| auto | length () const -> xtd::size override |
| Gets the length of the stream in bytes. | |
| auto | position () const -> xtd::size override |
| Gets the current position within the stream. | |
| auto | position (xtd::size value) -> void override |
| Sets the current position within the stream. | |
| auto | read_timeout () const -> xtd::int32 override |
| Gets the amount of time that a read operation blocks waiting for data. | |
| auto | read_timeout (xtd::int32 value) -> void override |
| Sets the amount of time that a read operation blocks waiting for data. | |
| auto | write_timeout () const -> xtd::int32 override |
| Gets the amount of time that a write operation blocks waiting for data. | |
| auto | write_timeout (xtd::int32 value) -> void override |
| Sets the amount of time that a write operation blocks waiting for data. | |
| auto | socket () const -> xtd::net::sockets::socket |
| Gets the underlying xtd::net::sockets::socket. | |
Public Methods | |
| auto | flush () -> void override |
| Flushes data from the stream. This method is reserved for future use. | |
| auto | read (xtd::array< xtd::byte > &buffer, size offset, size count) -> xtd::size override |
| Reads a block of bytes from the current stream and writes the data to a buffer. | |
| auto | set_length (xtd::size value) -> void override |
| Sets the length of the current stream to the specified value. | |
| auto | write (const xtd::array< xtd::byte > &buffer, size offset, size count) -> void override |
| Writes a block of bytes to the current stream using data read from a buffer. | |
| virtual auto | read (xtd::span< xtd::byte > &buffer) -> xtd::size |
| When overridden in a derived class, reads a sequence of bytes from the current stream and advances the position within the stream by the number of bytes read. | |
| virtual auto | write (xtd::span< const xtd::byte > buffer) -> void |
Additional Inherited Members | |
| static xtd::io::null_stream | null_stream |
| A Stream with no backing store. | |
| static constexpr xtd::int32 | eof |
| Represnets an eof value. | |
| virtual auto | is_closed () const noexcept -> bool |
| Indicates if the stream is closed. | |
| auto | copy_to (std::ostream &destination) -> void |
| Reads the bytes from the current memory stream and writes them to another stream. | |
| auto | copy_to (std::ostream &destination, xtd::size buffer_size) -> void |
| Reads the bytes from the current memory stream and writes them to another stream, using a specified buffer size. | |
| auto | read_at_least (xtd::array< xtd::byte > &buffer, xtd::size minimum_bytes, bool throw_on_end_of_stream=true) -> xtd::size |
| Reads at least a minimum number of bytes from the current stream and advances the position within the stream by the number of bytes read. | |
| virtual auto | read_byte () -> xtd::int32 |
| auto | read_exactly (xtd::array< xtd::byte > &buffer) -> void |
| Reads bytes from the current stream and advances the position within the stream until the buffer is filled. | |
| auto | read_exactly (xtd::array< xtd::byte > &buffer, xtd::size offset, xtd::size count) -> void |
| Reads count number of bytes from the current stream and advances the position within the stream. | |
| virtual auto | write_byte (xtd::byte value) -> void |
| object ()=default | |
| Create a new instance of the ultimate base class object. | |
| virtual bool | equals (const object &obj) const noexcept |
| Determines whether the specified object is equal to the current object. | |
| virtual xtd::size | get_hash_code () const noexcept |
| Serves as a hash function for a particular type. | |
| virtual type_object | get_type () const noexcept |
| Gets the type of the current instance. | |
| template<class object_t> | |
| xtd::unique_ptr_object< object_t > | memberwise_clone () const |
| Creates a shallow copy of the current object. | |
| virtual xtd::string | to_string () const |
| Returns a xtd::string that represents the current object. | |
| template<class object_a_t, class object_b_t> | |
| static bool | equals (const object_a_t &object_a, const object_b_t &object_b) noexcept |
| Determines whether the specified object instances are considered equal. | |
| template<class object_a_t, class object_b_t> | |
| static bool | reference_equals (const object_a_t &object_a, const object_b_t &object_b) noexcept |
| Determines whether the specified object instances are the same instance. | |
| stream () | |
| Initializes a new instance of the xtd::io::stream class. | |
| abstract_object ()=default | |
| Initializes a new instance of the xtd::abstract_object class. | |
|
explicit |
Creates a new instance of the network_stream class for the specified xtd::net::sockets::socket.
| socket | The xtd::net::sockets::socket that the xtd::net::sockets::network_stream will use to send and receive data. |
| xtd::net::sockets::network_stream::network_stream | ( | const xtd::net::sockets::socket & | socket, |
| bool | owns_socket ) |
Initializes a new instance of the xtd::net::sockets::network_stream class for the specified xtd::net::sockets::socket with the specified xtd::net::sockets::socket ownership.
| socket | The xtd::net::sockets::socket that the xtd::net::sockets::network_stream will use to send and receive data. |
| owns_socket | Set to true to indicate that the xtd::net::sockets::network_stream will take ownership of the xtd::net::sockets::socket; otherwise, false. |
| xtd::net::sockets::network_stream::network_stream | ( | const xtd::net::sockets::socket & | socket, |
| xtd::io::file_access | access ) |
Initializes a new instance of the network_stream class for the specified xtd::net::sockets::socket with the specified access rights.
| socket | The xtd::net::sockets::socket that the xtd::net::sockets::network_stream will use to send and receive data. |
| access | A bitwise combination of the xtd::io::file_access values that specify the type of access given to the xtd::net::sockets::network_stream over the provided xtd::net::sockets::socket. |
| xtd::net::sockets::network_stream::network_stream | ( | const xtd::net::sockets::socket & | socket, |
| xtd::io::file_access | access, | ||
| bool | owns_socket ) |
Initializes a new instance of the network_stream class for the specified xtd::net::sockets::socket with the specified access rights and the specified xtd::net::sockets::socket ownership.
| socket | The xtd::net::sockets::socket that the xtd::net::sockets::network_stream will use to send and receive data. |
| access | A bitwise combination of the xtd::io::file_access values that specify the type of access given to the xtd::net::sockets::network_stream over the provided xtd::net::sockets::socket. |
| owns_socket | Set to true to indicate that the xtd::net::sockets::network_stream will take ownership of the xtd::net::sockets::socket; otherwise, false. |
|
nodiscardoverridevirtualnoexcept |
Gets a value indicating whether the current stream supports reading.
Implements xtd::io::stream.
|
nodiscardoverridevirtualnoexcept |
Gets a value indicating whether the current stream supports seeking.
Implements xtd::io::stream.
|
nodiscardoverridevirtualnoexcept |
Indicates whether timeout properties are usable for xtd::net::sockets::network_stream.
Reimplemented from xtd::io::stream.
|
nodiscardoverridevirtualnoexcept |
Gets a value indicating whether the current stream supports writing.
Implements xtd::io::stream.
|
nodiscardvirtual |
Gets a value that indicates whether data is available on the xtd::net::sockets::network_stream to be read.
| xtd::net::sockets::socket_exception | An error occurred when attempting to access the socket. |
| xtd::object_closed_exception | The xtd::net::sockets::socket has been closed. |
|
nodiscardoverridevirtual |
Gets the length of the stream in bytes.
Implements xtd::io::stream.
|
nodiscardoverridevirtual |
Gets the current position within the stream.
Implements xtd::io::stream.
|
overridevirtual |
Sets the current position within the stream.
| value | The current position within the stream. |
Implements xtd::io::stream.
|
nodiscardoverridevirtual |
Gets the amount of time that a read operation blocks waiting for data.
Reimplemented from xtd::io::stream.
|
overridevirtual |
Sets the amount of time that a read operation blocks waiting for data.
| value | A xtd::int32 that specifies the amount of time, in milliseconds, that will elapse before a read operation fails. The default value, xtd::threading::timeout::infinite, specifies that the read operation does not time out. |
Reimplemented from xtd::io::stream.
|
nodiscardoverridevirtual |
Gets the amount of time that a write operation blocks waiting for data.
Reimplemented from xtd::io::stream.
|
overridevirtual |
Sets the amount of time that a write operation blocks waiting for data.
| value | A xtd::int32 that specifies the amount of time, in milliseconds, that will elapse before a read operation fails. The default value, xtd::threading::timeout::infinite, specifies that the read operation does not time out. |
Reimplemented from xtd::io::stream.
|
nodiscard |
Gets the underlying xtd::net::sockets::socket.
|
overridevirtual |
Flushes data from the stream. This method is reserved for future use.
Implements xtd::io::stream.
|
overridevirtual |
Reads a block of bytes from the current stream and writes the data to a buffer.
| buffer | When this method returns, contains the specified byte array with the values between offset and (offset + count - 1) replaced by the characters read from the current stream. |
| offset | The zero-based byte offset in buffer at which to begin storing data from the current stream. |
| count | The maximum number of bytes to read. |
Implements xtd::io::stream.
|
overridevirtual |
Sets the length of the current stream to the specified value.
| value | The value at which to set the length. |
Implements xtd::io::stream.
|
overridevirtual |
Writes a block of bytes to the current stream using data read from a buffer.
| buffer | The buffer to write data from. |
| offset | The zero-based byte offset in buffer at which to begin copying bytes to the current stream. |
| count | The maximum number of bytes to write. |
Implements xtd::io::stream.
|
virtual |
When overridden in a derived class, reads a sequence of bytes from the current stream and advances the position within the stream by the number of bytes read.
| buffer | A region of memory. When this method returns, the contents of this region are replaced by the bytes read from the current source. |
Reimplemented from xtd::io::stream.
Reimplemented from xtd::io::stream.