using System.Net;
using System.Net.Sockets;

namespace Forwarder.Services.Implementations.NetworkSenders;

/// <summary>
/// Отправляет сообщения по UDP.
/// </summary>
/// <param name="client">UDP-клиент.</param>
/// <param name="endPoint">Получатель.</param>
internal class UdpNetworkSender(
	UdpClient client,
	IPEndPoint endPoint
) : INetworkSender
{
	/// <inheritdoc />
	public async Task SendAsync(byte[] message, CancellationToken cancellationToken)
	{
		_ = await client.SendAsync(
			message,
			endPoint,
			cancellationToken
		);
	}
}