xtd - Reference Guide  0.1.0
Modern c++17/20 framework to create console, GUI and unit test applications on Windows, macOS, Linux, iOS and android.
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
xtd::net::sockets::send_packets_element Class Reference

#include <send_packets_element.h>

Definition

Represents an element in a xtd::net::sockets::send_packets_element array.

Namespace
xtd::net::sockets
Library
xtd.core
Remarks
The xtd::net::sockets::send_packets_element class is used to enhance the xtd::net::sockets::socket class for use by server applications that use asynchronous network I/O to achieve the highest performance. The xtd::net::sockets::send_packets_element class is used with the xtd::net::sockets::socket_async_event_args::send_packets_elements property to get or set a data buffer or file to be sent using the xtd::net::sockets::socket::send_packets_async method.

Inherits xtd::object.

Public Types

using ifstream_ref = std::reference_wrapper< std::ifstream >
 Represent ta std::ifstream reference.
 

Public Member Functions

 send_packets_element ()=default
 Initializes a new instance of the xtd::net::sockets::send_packets_element class.
 
 send_packets_element (const std::vector< byte_t > &buffer)
 Initializes a new instance of the xtd::net::sockets::send_packets_element class using the specified buffer.
 
 send_packets_element (const std::vector< byte_t > &buffer, size_t offset, size_t count)
 Initializes a new instance of the xtd::net::sockets::send_packets_element class using the specified range of the buffer with an option to combine this element with the next element in a single send request from the sockets layer to the transport.
 
 send_packets_element (const std::vector< byte_t > &buffer, size_t offset, size_t count, bool end_of_packet)
 Initializes a new instance of the xtd::net::sockets::send_packets_element class using the specified range of the buffer with an option to combine this element with the next element in a single send request from the sockets layer to the transport.
 
 send_packets_element (const xtd::ustring &file_path)
 Initializes a new instance of the xtd::net::sockets::send_packets_element class using the specified file.
 
 send_packets_element (const xtd::ustring &file_path, size_t offset, size_t count)
 Initializes a new instance of the xtd::net::sockets::send_packets_element class using the specified range of the file with an option to combine this element with the next element in a single send request from the sockets layer to the transport.
 
 send_packets_element (const xtd::ustring &file_path, size_t offset, size_t count, bool end_of_packet)
 Initializes a new instance of the xtd::net::sockets::send_packets_element class using the specified range of the file with an option to combine this element with the next element in a single send request from the sockets layer to the transport.
 
 send_packets_element (std::ifstream &file_stream)
 Initializes a new instance of the xtd::net::sockets::send_packets_element class using the specified FileStream object.
 
 send_packets_element (std::ifstream &file_stream, size_t offset, size_t count, bool end_of_packet)
 Initializes a new instance of the xtd::net::sockets::send_packets_element class using the specified range of the buffer with an option to combine this element with the next element in a single send request from the sockets layer to the transport.
 
std::vector< byte_t > buffer () const noexcept
 Gets the buffer to be sent if the xtd::net::sockets::send_packets_element object was initialized with a buffer parameter.
 
size_t count () const noexcept
 Gets the count of bytes to be sent.
 
bool end_of_packet () const noexcept
 Gets a bool value that indicates if this element should not be combined with the next element in a single send request from the sockets layer to the transport.
 
const xtd::ustringfile_path () const noexcept
 Gets the filename of the file to send if the xtd::net::sockets::send_packets_element object was initialized with a file_path parameter.
 
std::optional< ifstream_reffile_stream () const noexcept
 Gets the object representation of the file to send if the xtd::net::sockets::send_packets_element object was initialized with a std::ifstream parameter.
 
size_t offset () const noexcept
 Gets the offset, in bytes, from the beginning of the data buffer or file to the location in the buffer or file to start sending the data.
 
- Public Member Functions inherited from xtd::object
 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 size_t get_hash_code () const noexcept
 Serves as a hash function for a particular type.
 
template<typename object_t >
std::unique_ptr< object_t > memberwise_clone () const
 Gets the type of the current instance.
 
virtual xtd::ustring to_string () const noexcept
 Returns a std::string that represents the current object.
 

Additional Inherited Members

- Static Public Member Functions inherited from xtd::object
static bool equals (const object &object_a, const object &object_b) noexcept
 Determines whether the specified object instances are considered equal.
 
static bool reference_equals (const object &object_a, const object &object_b) noexcept
 Determines whether the specified object instances are the same instance.
 

Member Typedef Documentation

◆ ifstream_ref

using xtd::net::sockets::send_packets_element::ifstream_ref = std::reference_wrapper<std::ifstream>

Represent ta std::ifstream reference.

Constructor & Destructor Documentation

◆ send_packets_element() [1/9]

xtd::net::sockets::send_packets_element::send_packets_element ( )
default

Initializes a new instance of the xtd::net::sockets::send_packets_element class.

◆ send_packets_element() [2/9]

xtd::net::sockets::send_packets_element::send_packets_element ( const std::vector< byte_t > &  buffer)

Initializes a new instance of the xtd::net::sockets::send_packets_element class using the specified buffer.

Parameters
bufferA byte array of data to send using the xtd::net::sockets::socket::send_packets_async method.
Remarks
The xtd::net::sockets::send_packets_element class is used with the xtd::net::sockets::socket::socket_async_event_args::send_packets_elements property to get or set a data buffer or file to be sent using the xtd::net::sockets::socket::socket::send_packets_async method.

◆ send_packets_element() [3/9]

xtd::net::sockets::send_packets_element::send_packets_element ( const xtd::ustring file_path,
size_t  offset,
size_t  count,
bool  end_of_packet 
)

Initializes a new instance of the xtd::net::sockets::send_packets_element class using the specified range of the file with an option to combine this element with the next element in a single send request from the sockets layer to the transport.

Parameters
file_pathThe filename of the file to be transmitted using the xtd::net::sockets::socket::send_packets_async method.
offsetThe offset, in bytes, from the beginning of the file to the location in the file to start sending the file specified in the file_path parameter.
countThe number of bytes to send starting from the offset parameter. If count is zero, the entire file is sent.
end_of_packetSpecifies that this element should not be combined with the next element in a single send request from the sockets layer to the transport. This flag is used for granular control of the content of each message on a datagram or message-oriented socket.
Remarks
The xtd::net::sockets::send_packets_element class is used with the xtd::net::sockets::socket::socket_async_event_args::send_packets_elements property to get or set a data buffer or file to be sent using the xtd::net::sockets::socket::socket::send_packets_async method.
Universal Naming Convention (UNC) paths are supported by the file_path parameter. If the file is in the current working directory, no path information needs to be specified.

◆ send_packets_element() [4/9]

xtd::net::sockets::send_packets_element::send_packets_element ( const std::vector< byte_t > &  buffer,
size_t  offset,
size_t  count,
bool  end_of_packet 
)

Initializes a new instance of the xtd::net::sockets::send_packets_element class using the specified range of the buffer with an option to combine this element with the next element in a single send request from the sockets layer to the transport.

Parameters
bufferA byte array of data to send using the xtd::net::sockets::socket::send_packets_async method.
offsetThe offset, in bytes, from the beginning of the buffer to the location in the buffer to start sending the data specified in the buffer parameter.
countThe number bytes to send starting from the offset parameter. If count is zero, no bytes are sent.
end_of_packetSpecifies that this element should not be combined with the next element in a single send request from the sockets layer to the transport. This flag is used for granular control of the content of each message on a datagram or message-oriented socket.
Remarks
The xtd::net::sockets::send_packets_element class is used with the xtd::net::sockets::socket::socket_async_event_args::send_packets_elements property to get or set a data buffer or file to be sent using the xtd::net::sockets::socket::socket::send_packets_async method.

◆ send_packets_element() [5/9]

xtd::net::sockets::send_packets_element::send_packets_element ( const xtd::ustring file_path,
size_t  offset,
size_t  count 
)

Initializes a new instance of the xtd::net::sockets::send_packets_element class using the specified range of the file with an option to combine this element with the next element in a single send request from the sockets layer to the transport.

Parameters
file_pathThe filename of the file to be transmitted using the xtd::net::sockets::socket::send_packets_async method.
offsetThe offset, in bytes, from the beginning of the file to the location in the file to start sending the file specified in the file_path parameter.
countThe number of bytes to send starting from the offset parameter. If count is zero, the entire file is sent.
Remarks
The xtd::net::sockets::send_packets_element class is used with the xtd::net::sockets::socket::socket_async_event_args::send_packets_elements property to get or set a data buffer or file to be sent using the xtd::net::sockets::socket::socket::send_packets_async method.
Universal Naming Convention (UNC) paths are supported by the file_path parameter. If the file is in the current working directory, no path information needs to be specified.

◆ send_packets_element() [6/9]

xtd::net::sockets::send_packets_element::send_packets_element ( std::ifstream &  file_stream,
size_t  offset,
size_t  count,
bool  end_of_packet 
)

Initializes a new instance of the xtd::net::sockets::send_packets_element class using the specified range of the buffer with an option to combine this element with the next element in a single send request from the sockets layer to the transport.

Parameters
file_streamThe file to be transmitted using the xtd::net::sockets::socket::send_packets_async method.
offsetThe offset, in bytes, from the beginning of the file to the location in the file to start sending the bytes in the file.
countThe number of bytes to send starting from the offset parameter. If count is zero, the entire file is sent.
end_of_packetSpecifies that this element should not be combined with the next element in a single send request from the sockets layer to the transport. This flag is used for granular control of the content of each message on a datagram or message-oriented socket.
Remarks
The xtd::net::sockets::send_packets_element class is used with the xtd::net::sockets::socket::socket_async_event_args::send_packets_elements property to get or set a data buffer or file to be sent using the xtd::net::sockets::socket::socket::send_packets_async method.

◆ send_packets_element() [7/9]

xtd::net::sockets::send_packets_element::send_packets_element ( const std::vector< byte_t > &  buffer,
size_t  offset,
size_t  count 
)

Initializes a new instance of the xtd::net::sockets::send_packets_element class using the specified range of the buffer with an option to combine this element with the next element in a single send request from the sockets layer to the transport.

Parameters
bufferA byte array of data to send using the xtd::net::sockets::socket::send_packets_async method.
offsetThe offset, in bytes, from the beginning of the buffer to the location in the buffer to start sending the data specified in the buffer parameter.
countThe number bytes to send starting from the offset parameter. If count is zero, no bytes are sent.
Remarks
The xtd::net::sockets::send_packets_element class is used with the xtd::net::sockets::socket::socket_async_event_args::send_packets_elements property to get or set a data buffer or file to be sent using the xtd::net::sockets::socket::socket::send_packets_async method.

◆ send_packets_element() [8/9]

xtd::net::sockets::send_packets_element::send_packets_element ( const xtd::ustring file_path)

Initializes a new instance of the xtd::net::sockets::send_packets_element class using the specified file.

Parameters
file_pathThe filename of the file to be transmitted using the xtd::net::sockets::socket::send_packets_async method.
Remarks
The xtd::net::sockets::send_packets_element class is used with the xtd::net::sockets::socket::socket_async_event_args::send_packets_elements property to get or set a data buffer or file to be sent using the xtd::net::sockets::socket::socket::send_packets_async method.
Universal Naming Convention (UNC) paths are supported by the file_path parameter. If the file is in the current working directory, no path information needs to be specified.

◆ send_packets_element() [9/9]

xtd::net::sockets::send_packets_element::send_packets_element ( std::ifstream &  file_stream)

Initializes a new instance of the xtd::net::sockets::send_packets_element class using the specified FileStream object.

Parameters
file_streamThe file to be transmitted using the xtd::net::sockets::socket::send_packets_async method.
Remarks
The xtd::net::sockets::send_packets_element class is used with the xtd::net::sockets::socket::socket_async_event_args::send_packets_elements property to get or set a data buffer or file to be sent using the xtd::net::sockets::socket::socket::send_packets_async method.

Member Function Documentation

◆ buffer()

std::vector< byte_t > xtd::net::sockets::send_packets_element::buffer ( ) const
noexcept

Gets the buffer to be sent if the xtd::net::sockets::send_packets_element object was initialized with a buffer parameter.

Returns
The byte buffer to send if the xtd::net::sockets::send_packets_element object was initialized with a buffer parameter.
Remarks
The default value for the xtd::net::sockets::send_packets_element::buffer property is empty if the xtd::net::sockets::send_packets_element object was not initialized with a buffer parameter.

◆ count()

size_t xtd::net::sockets::send_packets_element::count ( ) const
noexcept

Gets the count of bytes to be sent.

Returns
The count of bytes to send if the xtd::net::sockets::send_packets_element class was initialized with a count parameter.
Remarks
The default value for the xtd::net::sockets::send_packets_element::count property is zero if the xtd::net::sockets::send_packets_element class was not initialized with a count parameter.
If Count is zero for a file, the entire file is sent. If xtd::net::sockets::send_packets_element::count is zero for a buffer, no bytes are sent.

◆ end_of_packet()

bool xtd::net::sockets::send_packets_element::end_of_packet ( ) const
noexcept

Gets a bool value that indicates if this element should not be combined with the next element in a single send request from the sockets layer to the transport.

Returns
A bool value that indicates if this element should not be combined with the next element in a single send request.
Remarks
The default value for the xtd::net::sockets::send_packets_element::end_of_packet property is false if the xtd::net::sockets::send_packets_element class was not initialized with an end_of_packet parameter set to true.

◆ file_path()

const xtd::ustring & xtd::net::sockets::send_packets_element::file_path ( ) const
noexcept

Gets the filename of the file to send if the xtd::net::sockets::send_packets_element object was initialized with a file_path parameter.

Returns
The filename of the file to send if the xtd::net::sockets::send_packets_element object was initialized with a file_path parameter.
Remarks
Universal Naming Convention (UNC) paths are supported by the xtd::net::sockets::send_packets_element::file_path property. If the file is in the current working directory, no path information needs to be specified.
The default value for the xtd::net::sockets::send_packets_element::file_path property is empty if the xtd::net::sockets::send_packets_element object was not initialized with a file_path parameter.

◆ file_stream()

std::optional< ifstream_ref > xtd::net::sockets::send_packets_element::file_stream ( ) const
noexcept

Gets the object representation of the file to send if the xtd::net::sockets::send_packets_element object was initialized with a std::ifstream parameter.

Remarks
An object representation of the file to send if the xtd::net::sockets::send_packets_element object was initialized with a std::ifstream parameter.
The default value for the xtd::net::sockets::send_packets_element::file_stream property is empty if the xtd::net::sockets::send_packets_element object was not initialized with a file_stream parameter.

◆ offset()

size_t xtd::net::sockets::send_packets_element::offset ( ) const
noexcept

Gets the offset, in bytes, from the beginning of the data buffer or file to the location in the buffer or file to start sending the data.

Returns
The offset, in bytes, from the beginning of the data buffer or file to the location in the buffer or file to start sending the data.
Remarks
The default value for the xtd::net::sockets::send_packets_element::offset property is zero if the xtd::net::sockets::send_packets_element class was not initialized with an offset parameter.

The documentation for this class was generated from the following file: