xtd - Reference Guide
0.1.1
Modern c++17/20 framework to create console, GUI and unit test applications on Windows, macOS, Linux, iOS and android.
|
#include <udp_client.h>
Provides User Datagram Protocol (UDP) network services.
Inherits xtd::object.
Public Member Functions | |
udp_client () | |
Initializes a new instance of the xtd::net::sockets::udp_client class. More... | |
udp_client (const xtd::net::ip_end_point &local_end_point) | |
Initializes a new instance of the xtd::net::sockets::udp_client class and binds it to the specified local endpoint. More... | |
udp_client (const xtd::ustring &hostname, uint16_t port) | |
Initializes a new instance of the xtd::net::sockets::udp_client class and establishes a default remote host. More... | |
udp_client (uint16_t port) | |
Initializes a new instance of the xtd::net::sockets::udp_client class and binds it to the local port number provided. More... | |
udp_client (uint16_t port, xtd::net::sockets::address_family addressFamily) | |
Initializes a new instance of the xtd::net::sockets::udp_client class and binds it to the local port number provided. More... | |
udp_client (xtd::net::sockets::address_family address_Family) | |
Initializes a new instance of the xtd::net::sockets::udp_client class. More... | |
void | allow_nat_traversal (bool allowed) |
Enables or disables Network Address Translation (NAT) traversal on a xtd::net::sockets::udp_client instance. More... | |
size_t | available () const |
Gets the amount of data received from the network that is available to read. More... | |
std::shared_ptr< xtd::iasync_result > | begin_receive (xtd::async_callback callback, const std::any &state) |
xtd::net::sockets::udp_client::receives a datagram from a remote host asynchronously. More... | |
std::shared_ptr< xtd::iasync_result > | begin_send (const std::vector< byte_t > &dgram, size_t bytes, const xtd::net::ip_end_point &end_point, xtd::async_callback callback, const std::any &state) |
xtd::net::sockets::udp_client::sends a datagram to a destination asynchronously. The destination is specified by a EndPoint. More... | |
std::shared_ptr< xtd::iasync_result > | begin_send (const std::vector< byte_t > &dgram, size_t bytes, const xtd::ustring &hostname, uint16_t port, xtd::async_callback callback, const std::any &state) |
xtd::net::sockets::udp_client::sends a datagram to a destination asynchronously. The destination is specified by the host name and port number. More... | |
std::shared_ptr< xtd::iasync_result > | begin_send (const std::vector< byte_t > &dgram, size_t bytes, xtd::async_callback callback, const std::any &state) |
xtd::net::sockets::udp_client::sends a datagram to a remote host asynchronously. The destination was specified previously by a call to xtd::net::sockets::udp_client::connect. More... | |
xtd::net::sockets::socket | client () const noexcept |
Gets the underlying network xtd::net::sockets::socket. More... | |
udp_client & | client (const xtd::net::sockets::socket &value) noexcept |
Sets the underlying network xtd::net::sockets::socket. More... | |
void | close () |
Closes the UDP connection. More... | |
void | connect (const xtd::net::ip_address &ip_address, uint16_t port) |
Establishes a default remote host using the specified IP address and port number. More... | |
void | connect (const xtd::net::ip_end_point &end_point) |
Establishes a default remote host using the specified network endpoint. More... | |
void | connect (const xtd::ustring &hostname, uint16_t port) |
Establishes a default remote host using the specified hostname and port number. More... | |
bool | dont_fragment () const |
Gets a boolean value that specifies whether the xtd::net::sockets::udp_client allows Internet Protocol (IP) datagrams to be fragmented. More... | |
udp_client & | dont_fragment (bool value) |
Sets boolean value that specifies whether the xtd::net::sockets::udp_client allows Internet Protocol (IP) datagrams to be fragmented. More... | |
void | drop_multicast_group (const xtd::net::ip_address &multicast_address) |
Leaves a multicast group. More... | |
void | drop_multicast_group (const xtd::net::ip_address &multicast_address, uint32_t if_index) |
Leaves a multicast group. More... | |
bool | enable_broadcast () const |
Gets a boolean value that specifies whether the xtd::net::sockets::udp_client may send or receive broadcast packets. More... | |
udp_client & | enable_broadcast (bool value) |
Sets a boolean value that specifies whether the xtd::net::sockets::udp_client may send or receive broadcast packets. More... | |
std::vector< byte_t > | end_receive (std::shared_ptr< xtd::iasync_result > async_result, xtd::net::ip_end_point &remote_end_point) |
Ends a pending asynchronous receive. More... | |
size_t | end_send (std::shared_ptr< xtd::iasync_result > async_result) |
Ends a pending asynchronous send. More... | |
bool | exclusive_address_use () const |
Gets a boolean value that specifies whether the xtd::net::sockets::udp_client allows only one client to use a port. More... | |
udp_client & | exclusive_address_use (bool value) |
Sets a boolean value that specifies whether the xtd::net::sockets::udp_client allows only one client to use a port. More... | |
void | join_multicast_group (const xtd::net::ip_address &multicast_address) |
Adds a xtd::net::sockets::udp_client to a multicast group. More... | |
void | join_multicast_group (const xtd::net::ip_address &multicast_address, byte_t ttl) |
Adds a xtd::net::sockets::udp_client to a multicast group with the specified Time to Live (TTL). More... | |
void | join_multicast_group (const xtd::net::ip_address &multicast_address, const xtd::net::ip_address &local_address) |
Adds a xtd::net::sockets::udp_client to a multicast group. More... | |
void | join_multicast_group (uint32_t if_index, const xtd::net::ip_address &multicast_address) |
Adds a xtd::net::sockets::udp_client to a multicast group. More... | |
bool | multicast_loopback () const |
Gets a boolean value that specifies whether outgoing multicast packets are delivered to the sending application. More... | |
udp_client & | multicast_loopback (bool value) |
Sets a boolean value that specifies whether outgoing multicast packets are delivered to the sending application. More... | |
std::vector< byte_t > | receive (xtd::net::ip_end_point &remote_end_point) |
Returns a UDP datagram that was sent by a remote host. More... | |
size_t | send (const std::vector< byte_t > &dgram, size_t bytes) |
xtd::net::sockets::udp_client::sends a UDP datagram to a remote host. More... | |
size_t | send (const std::vector< byte_t > &dgram, size_t bytes, const xtd::net::ip_end_point &end_point) |
xtd::net::sockets::udp_client::sends a UDP datagram to the host at the specified remote endpoint. More... | |
size_t | send (const std::vector< byte_t > &dgram, size_t bytes, const xtd::ustring &hostname, uint16_t port) |
xtd::net::sockets::udp_client::sends a UDP datagram to a specified port on a specified remote host. More... | |
byte_t | ttl () const |
Gets a value that specifies the Time to Live (TTL) value of Internet Protocol (IP) packets sent by the xtd::net::sockets::udp_client. More... | |
udp_client & | ttl (byte_t value) |
Sets a value that specifies the Time to Live (TTL) value of Internet Protocol (IP) packets sent by the xtd::net::sockets::udp_client. More... | |
Public Member Functions inherited from xtd::object | |
object ()=default | |
Create a new instance of the ultimate base class object. More... | |
virtual bool | equals (const object &obj) const noexcept |
Determines whether the specified object is equal to the current object. More... | |
virtual size_t | get_hash_code () const noexcept |
Serves as a hash function for a particular type. More... | |
template<typename object_t > | |
std::unique_ptr< object_t > | memberwise_clone () const |
Gets the type of the current instance. More... | |
virtual xtd::ustring | to_string () const noexcept |
Returns a std::string that represents the current object. More... | |
Protected Member Functions | |
bool | active () const noexcept |
Gets a value that indicates whether a connection has been made. More... | |
udp_client & | active (bool value) noexcept |
Sets a value that indicates whether a connection has been made. More... | |
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. More... | |
static bool | reference_equals (const object &object_a, const object &object_b) noexcept |
Determines whether the specified object instances are the same instance. More... | |
xtd::net::sockets::udp_client::udp_client | ( | ) |
Initializes a new instance of the xtd::net::sockets::udp_client class.
xtd::net::sockets::socket_exception | An error occurred when attempting to access the underlying socket. |
|
explicit |
Initializes a new instance of the xtd::net::sockets::udp_client class and binds it to the local port number provided.
port | The local port number from which you intend to communicate. |
xtd::net::sockets::socket_exception | An error occurred when attempting to access the underlying socket. |
|
explicit |
Initializes a new instance of the xtd::net::sockets::udp_client class and binds it to the specified local endpoint.
local_end_point | An xtd::net::ip_end_point that represents the local endpoint to which you bind the UDP connection. |
xtd::net::sockets::socket_exception | An error occurred when attempting to access the underlying socket. |
|
explicit |
Initializes a new instance of the xtd::net::sockets::udp_client class.
address_family | one of the xtd::net::sockets::address_family values that specifies the addressing scheme of the socket. |
xtd::argument_exception | family is not xtd::net::sockets::address_family::inter_network or xtd::net::sockets::address_family::inter_network_v6. |
xtd::net::sockets::socket_exception | An error occurred when attempting to access the underlying socket. |
xtd::net::sockets::udp_client::udp_client | ( | uint16_t | port, |
xtd::net::sockets::address_family | addressFamily | ||
) |
Initializes a new instance of the xtd::net::sockets::udp_client class and binds it to the local port number provided.
port | The port on which to listen for incoming connection attempts. |
address_family | One of the xtd::net::sockets::address_family values that specifies the addressing scheme of the socket. |
xtd::argument_exception | family is not xtd::net::sockets::address_family::inter_network or xtd::net::sockets::address_family::inter_network_v6. |
xtd::net::sockets::socket_exception | An error occurred when attempting to access the underlying socket. |
xtd::net::sockets::udp_client::udp_client | ( | const xtd::ustring & | hostname, |
uint16_t | port | ||
) |
Initializes a new instance of the xtd::net::sockets::udp_client class and establishes a default remote host.
hostname | The name of the remote DNS host to which you intend to connect. |
port | The remote port number to which you intend to connect. |
xtd::net::sockets::socket_exception | An error occurred when attempting to access the underlying socket. |
|
protectednoexcept |
Gets a value that indicates whether a connection has been made.
|
protectednoexcept |
Sets a value that indicates whether a connection has been made.
value | bool true if the connection has been made; otherwise, false. |
void xtd::net::sockets::udp_client::allow_nat_traversal | ( | bool | allowed | ) |
Enables or disables Network Address Translation (NAT) traversal on a xtd::net::sockets::udp_client instance.
allowed | A boolean value that specifies whether to enable or disable NAT traversal. |
xtd::net::sockets::socket_exception | An error occurred when attempting to access the underlying socket. |
size_t xtd::net::sockets::udp_client::available | ( | ) | const |
Gets the amount of data received from the network that is available to read.
xtd::net::sockets::socket_exception | An error occurred when attempting to access the underlying socket. |
xtd::object_closed_exception | The underlying xtd::net::sockets::socket has been closed. |
std::shared_ptr<xtd::iasync_result> xtd::net::sockets::udp_client::begin_receive | ( | xtd::async_callback | callback, |
const std::any & | state | ||
) |
xtd::net::sockets::udp_client::receives a datagram from a remote host asynchronously.
callback | An xtd::async_callback delegate that references the method to invoke when the operation is complete. |
state | A user-defined object that contains information about the receive operation. This object is passed to the callback delegate when the operation is complete. |
std::shared_ptr<xtd::iasync_result> xtd::net::sockets::udp_client::begin_send | ( | const std::vector< byte_t > & | dgram, |
size_t | bytes, | ||
const xtd::net::ip_end_point & | end_point, | ||
xtd::async_callback | callback, | ||
const std::any & | state | ||
) |
xtd::net::sockets::udp_client::sends a datagram to a destination asynchronously. The destination is specified by a EndPoint.
dgram | A byte array that contains the data to be sent. |
bytes | The number of bytes to send. |
end_point | The EndPoint that represents the destination for the data. |
callback | An xtd::async_callback delegate that references the method to invoke when the operation is complete. |
state | A user-defined object that contains information about the send operation. This object is passed to the callback delegate when the operation is complete. |
std::shared_ptr<xtd::iasync_result> xtd::net::sockets::udp_client::begin_send | ( | const std::vector< byte_t > & | dgram, |
size_t | bytes, | ||
const xtd::ustring & | hostname, | ||
uint16_t | port, | ||
xtd::async_callback | callback, | ||
const std::any & | state | ||
) |
xtd::net::sockets::udp_client::sends a datagram to a destination asynchronously. The destination is specified by the host name and port number.
dgram | A byte array that contains the data to be sent. |
bytes | The number of bytes to send. |
hostname | The destination host. |
port | The destination port number. |
callback | An xtd::async_callback delegate that references the method to invoke when the operation is complete. |
state | A user-defined object that contains information about the send operation. This object is passed to the callback delegate when the operation is complete. |
std::shared_ptr<xtd::iasync_result> xtd::net::sockets::udp_client::begin_send | ( | const std::vector< byte_t > & | dgram, |
size_t | bytes, | ||
xtd::async_callback | callback, | ||
const std::any & | state | ||
) |
xtd::net::sockets::udp_client::sends a datagram to a remote host asynchronously. The destination was specified previously by a call to xtd::net::sockets::udp_client::connect.
dgram | A byte array that contains the data to be sent. |
bytes | The number of bytes to send. |
callback | An xtd::async_callback delegate that references the method to invoke when the operation is complete. |
state | A user-defined object that contains information about the send operation. This object is passed to the callback delegate when the operation is complete. |
|
noexcept |
Gets the underlying network xtd::net::sockets::socket.
|
noexcept |
Sets the underlying network xtd::net::sockets::socket.
value | The underlying Network xtd::net::sockets::socket. |
void xtd::net::sockets::udp_client::close | ( | ) |
Closes the UDP connection.
xtd::net::sockets::socket_exception | An error occurred when attempting to access the underlying socket. |
void xtd::net::sockets::udp_client::connect | ( | const xtd::net::ip_address & | ip_address, |
uint16_t | port | ||
) |
Establishes a default remote host using the specified IP address and port number.
ip_address | The xtd::net::ip_address of the remote host to which you intend to send data |
port | The port number to which you intend send data |
xtd::net::sockets::socket_exception | An error occurred when attempting to access the underlying socket. |
xtd::object_closed_exception | The underlying xtd::net::sockets::socket has been closed. |
void xtd::net::sockets::udp_client::connect | ( | const xtd::net::ip_end_point & | end_point | ) |
Establishes a default remote host using the specified network endpoint.
end_point | An xtd::net::ip_end_point that specifies the network endpoint to which you intend to send data |
xtd::net::sockets::socket_exception | An error occurred when attempting to access the underlying socket. |
xtd::object_closed_exception | The underlying xtd::net::sockets::socket has been closed. |
void xtd::net::sockets::udp_client::connect | ( | const xtd::ustring & | hostname, |
uint16_t | port | ||
) |
Establishes a default remote host using the specified hostname and port number.
hostname | the hostname to connect to. |
port | The port number to which you intend send data |
xtd::net::sockets::socket_exception | An error occurred when attempting to access the underlying socket. |
xtd::object_closed_exception | The underlying xtd::net::sockets::socket has been closed. |
bool xtd::net::sockets::udp_client::dont_fragment | ( | ) | const |
Gets a boolean value that specifies whether the xtd::net::sockets::udp_client allows Internet Protocol (IP) datagrams to be fragmented.
xtd::net::sockets::socket_exception | An error occurred when attempting to access the underlying socket. |
xtd::object_closed_exception | The underlying xtd::net::sockets::socket has been closed. |
udp_client& xtd::net::sockets::udp_client::dont_fragment | ( | bool | value | ) |
Sets boolean value that specifies whether the xtd::net::sockets::udp_client allows Internet Protocol (IP) datagrams to be fragmented.
value | true if the xtd::net::sockets::udp_client allows datagram fragmentation; otherwise, false. The default is true. |
xtd::net::sockets::socket_exception | An error occurred when attempting to access the underlying socket. |
xtd::object_closed_exception | The underlying xtd::net::sockets::socket has been closed. |
void xtd::net::sockets::udp_client::drop_multicast_group | ( | const xtd::net::ip_address & | multicast_address | ) |
Leaves a multicast group.
multicast_address | The xtd::net::ip_address of the multicast group to leave. |
xtd::net::sockets::socket_exception | An error occurred when attempting to access the underlying socket. |
xtd::object_closed_exception | The underlying xtd::net::sockets::socket has been closed. |
void xtd::net::sockets::udp_client::drop_multicast_group | ( | const xtd::net::ip_address & | multicast_address, |
uint32_t | if_index | ||
) |
Leaves a multicast group.
multicast_address | The xtd::net::ip_address of the multicast group to leave. |
if_index | The local address of the multicast group to leave. |
xtd::net::sockets::socket_exception | An error occurred when attempting to access the underlying socket. |
xtd::object_closed_exception | The underlying xtd::net::sockets::socket has been closed. |
bool xtd::net::sockets::udp_client::enable_broadcast | ( | ) | const |
Gets a boolean value that specifies whether the xtd::net::sockets::udp_client may send or receive broadcast packets.
xtd::net::sockets::socket_exception | An error occurred when attempting to access the underlying socket. |
xtd::object_closed_exception | The underlying xtd::net::sockets::socket has been closed. |
udp_client& xtd::net::sockets::udp_client::enable_broadcast | ( | bool | value | ) |
Sets a boolean value that specifies whether the xtd::net::sockets::udp_client may send or receive broadcast packets.
value | true if the xtd::net::sockets::udp_client allows broadcast packets; otherwise, false. The default is false. |
xtd::net::sockets::socket_exception | An error occurred when attempting to access the underlying socket. |
xtd::object_closed_exception | The underlying xtd::net::sockets::socket has been closed. |
std::vector<byte_t> xtd::net::sockets::udp_client::end_receive | ( | std::shared_ptr< xtd::iasync_result > | async_result, |
xtd::net::ip_end_point & | remote_end_point | ||
) |
Ends a pending asynchronous receive.
async_result | An xtd::iasync_result object returned by a call to xtd::net::sockets::udp_client::begin_receive(xtd::async_callback, Object). |
remote_end_point | The specified remote endpoint. |
argument_exception | asyncResult was not returned by a call to the xtd::net::sockets::udp_client::begin_receive method. |
xtd::net::sockets::socket_exception | An error occurred when attempting to access the underlying socket. |
xtd::object_closed_exception | The underlying xtd::net::sockets::socket has been closed. |
size_t xtd::net::sockets::udp_client::end_send | ( | std::shared_ptr< xtd::iasync_result > | async_result | ) |
Ends a pending asynchronous send.
async_result | An xtd::iasync_result object returned by a call to xtd::net::sockets::udp_client::begin_send. |
argument_exception | asyncResult was not returned by a call to the xtd::net::sockets::udp_client::begin_send method. |
xtd::net::sockets::socket_exception | An error occurred when attempting to access the underlying socket. |
xtd::object_closed_exception | The underlying xtd::net::sockets::socket has been closed. |
bool xtd::net::sockets::udp_client::exclusive_address_use | ( | ) | const |
Gets a boolean value that specifies whether the xtd::net::sockets::udp_client allows only one client to use a port.
xtd::net::sockets::socket_exception | An error occurred when attempting to access the underlying socket. |
xtd::object_closed_exception | The underlying xtd::net::sockets::socket has been closed. |
udp_client& xtd::net::sockets::udp_client::exclusive_address_use | ( | bool | value | ) |
Sets a boolean value that specifies whether the xtd::net::sockets::udp_client allows only one client to use a port.
value | true if the xtd::net::sockets::udp_client allows only one client to use a specific port; otherwise, false. The default is true for Windows Server 2003 and Windows XP Service Pack 2 and later, and false for all other versions. |
xtd::net::sockets::socket_exception | An error occurred when attempting to access the underlying socket. |
xtd::object_closed_exception | The underlying xtd::net::sockets::socket has been closed. |
void xtd::net::sockets::udp_client::join_multicast_group | ( | const xtd::net::ip_address & | multicast_address | ) |
Adds a xtd::net::sockets::udp_client to a multicast group.
multicast_address | The multicast xtd::net::ip_address of the group you want to join. |
argument_exception | The IP address is not compatible with the xtd::net::sockets::address_family value that defines the addressing scheme of the socket. |
xtd::net::sockets::socket_exception | An error occurred when attempting to access the underlying socket. |
xtd::object_closed_exception | The underlying xtd::net::sockets::socket has been closed. |
void xtd::net::sockets::udp_client::join_multicast_group | ( | const xtd::net::ip_address & | multicast_address, |
byte_t | ttl | ||
) |
Adds a xtd::net::sockets::udp_client to a multicast group with the specified Time to Live (TTL).
multicast_address | The multicast xtd::net::ip_address of the group you want to join. |
ttl | The Time to Live (TTL), measured in router hops. |
argument_exception | The IP address is not compatible with the xtd::net::sockets::address_family value that defines the addressing scheme of the socket. |
xtd::net::sockets::socket_exception | An error occurred when attempting to access the underlying socket. |
xtd::object_closed_exception | The underlying xtd::net::sockets::socket has been closed. |
void xtd::net::sockets::udp_client::join_multicast_group | ( | const xtd::net::ip_address & | multicast_address, |
const xtd::net::ip_address & | local_address | ||
) |
Adds a xtd::net::sockets::udp_client to a multicast group.
multicast_address | The multicast xtd::net::ip_address of the group you want to join. |
local_address | The local xtd::net::ip_address. |
xtd::net::sockets::socket_exception | An error occurred when attempting to access the underlying socket. |
xtd::object_closed_exception | The underlying xtd::net::sockets::socket has been closed. |
void xtd::net::sockets::udp_client::join_multicast_group | ( | uint32_t | if_index, |
const xtd::net::ip_address & | multicast_address | ||
) |
Adds a xtd::net::sockets::udp_client to a multicast group.
if_index | The interface index associated with the local IP address on which to join the multicast group. |
multicast_address | The multicast xtd::net::ip_address of the group you want to join. |
argument_exception | The IP address is not compatible with the xtd::net::sockets::address_family value that defines the addressing scheme of the socket. |
xtd::net::sockets::socket_exception | An error occurred when attempting to access the underlying socket. |
xtd::object_closed_exception | The underlying xtd::net::sockets::socket has been closed. |
bool xtd::net::sockets::udp_client::multicast_loopback | ( | ) | const |
Gets a boolean value that specifies whether outgoing multicast packets are delivered to the sending application.
xtd::net::sockets::socket_exception | An error occurred when attempting to access the underlying socket. |
xtd::object_closed_exception | The underlying xtd::net::sockets::socket has been closed. |
udp_client& xtd::net::sockets::udp_client::multicast_loopback | ( | bool | value | ) |
Sets a boolean value that specifies whether outgoing multicast packets are delivered to the sending application.
value | true if the xtd::net::sockets::udp_client receives outgoing multicast packets; otherwise, false. |
xtd::net::sockets::socket_exception | An error occurred when attempting to access the underlying socket. |
xtd::object_closed_exception | The underlying xtd::net::sockets::socket has been closed. |
std::vector<byte_t> xtd::net::sockets::udp_client::receive | ( | xtd::net::ip_end_point & | remote_end_point | ) |
Returns a UDP datagram that was sent by a remote host.
remote_end_point | An xtd::net::ip_end_point that represents the remote host from which the data was sent. |
xtd::net::sockets::socket_exception | An error occurred when attempting to access the underlying socket. |
xtd::object_closed_exception | The underlying xtd::net::sockets::socket has been closed. |
size_t xtd::net::sockets::udp_client::send | ( | const std::vector< byte_t > & | dgram, |
size_t | bytes | ||
) |
xtd::net::sockets::udp_client::sends a UDP datagram to a remote host.
dgram | An array of type Byte that specifies the UDP datagram that you intend to send represented as an array of bytes. |
bytes | The number of bytes in the datagram. |
xtd::net::sockets::socket_exception | An error occurred when attempting to access the underlying socket. |
xtd::object_closed_exception | The underlying xtd::net::sockets::socket has been closed. |
size_t xtd::net::sockets::udp_client::send | ( | const std::vector< byte_t > & | dgram, |
size_t | bytes, | ||
const xtd::net::ip_end_point & | end_point | ||
) |
xtd::net::sockets::udp_client::sends a UDP datagram to the host at the specified remote endpoint.
dgram | An array of type Byte that specifies the UDP datagram that you intend to send, represented as an array of bytes. |
bytes | The number of bytes in the datagram. |
end_point | An xtd::net::ip_end_point that represents the host and port to which to send the datagram. |
xtd::net::sockets::socket_exception | An error occurred when attempting to access the underlying socket. |
xtd::object_closed_exception | The underlying xtd::net::sockets::socket has been closed. |
size_t xtd::net::sockets::udp_client::send | ( | const std::vector< byte_t > & | dgram, |
size_t | bytes, | ||
const xtd::ustring & | hostname, | ||
uint16_t | port | ||
) |
xtd::net::sockets::udp_client::sends a UDP datagram to a specified port on a specified remote host.
dgram | An array of type Byte that specifies the UDP datagram that you intend to send represented as an array of bytes. |
bytes | The number of bytes in the datagram. |
hostname | The name of the remote host to which you intend to send the datagram. |
port | The remote port number with which you intend to communicate. |
xtd::net::sockets::socket_exception | An error occurred when attempting to access the underlying socket. |
xtd::object_closed_exception | The underlying xtd::net::sockets::socket has been closed. |
byte_t xtd::net::sockets::udp_client::ttl | ( | ) | const |
Gets a value that specifies the Time to Live (TTL) value of Internet Protocol (IP) packets sent by the xtd::net::sockets::udp_client.
xtd::net::sockets::socket_exception | An error occurred when attempting to access the underlying socket. |
xtd::object_closed_exception | The underlying xtd::net::sockets::socket has been closed. |
udp_client& xtd::net::sockets::udp_client::ttl | ( | byte_t | value | ) |
Sets a value that specifies the Time to Live (TTL) value of Internet Protocol (IP) packets sent by the xtd::net::sockets::udp_client.
value | The TTL value. |
xtd::net::sockets::socket_exception | An error occurred when attempting to access the underlying socket. |
xtd::object_closed_exception | The underlying xtd::net::sockets::socket has been closed. |