From ff1155fa9635d248a9d27809c346d4b1118ae9e9 Mon Sep 17 00:00:00 2001 From: Jakob Date: Tue, 7 May 2024 23:11:48 +0200 Subject: [PATCH] Chore: Add documentation to Z21Communicator --- Z21Client/Z21Communicator.cs | 38 +++++++++++++++++++++++++++++++++--- 1 file changed, 35 insertions(+), 3 deletions(-) diff --git a/Z21Client/Z21Communicator.cs b/Z21Client/Z21Communicator.cs index d609fc7..c043b54 100644 --- a/Z21Client/Z21Communicator.cs +++ b/Z21Client/Z21Communicator.cs @@ -22,19 +22,51 @@ namespace Z21 { public class Z21Communicator(int port) : UdpClient(port), IZ21Communicator { + /// + /// Enables or disables Network Address Translation (NAT) traversal on a System.Net.Sockets.UdpClient instance. + /// + /// A Boolean value that specifies whether to enable or disable NAT traversal. [SupportedOSPlatform("windows")] - public new void AllowNatTraversal(bool v) => base.AllowNatTraversal(v); + public new void AllowNatTraversal(bool allowed) => base.AllowNatTraversal(allowed); - public new void BeginReceive(AsyncCallback asyncCallback, object value) => base.BeginReceive(asyncCallback, value); + /// + /// Receives a datagram from a remote host asynchronously. + /// + /// An System.AsyncCallback delegate that references the method to invoke when the operation is complete. + /// A user-defined object that contains information about the receive operation.This object is passed to the requestCallback delegate when the operation is complete. + public new void BeginReceive(AsyncCallback asyncCallback, object state) => base.BeginReceive(asyncCallback, state); + /// + /// Closes the UDP connection. + /// public new void Close() => base.Close(); + /// + /// Establishes a default remote host using the specified IP address and port number. + /// + /// The System.Net.IPAddress of the remote host to which you intend to send data. + /// The port number to which you intend send data. public new void Connect(IPAddress address, int port) => base.Connect(address, port); + /// + /// Releases the managed and unmanaged resources used by the System.Net.Sockets.UdpClient. + /// public new void Dispose() => base.Dispose(); - public new byte[] EndReceive(IAsyncResult res, ref IPEndPoint? iPEndPoint) => base.EndReceive(res, ref iPEndPoint); + /// + /// Ends a pending asynchronous receive. + /// + /// An System.IAsyncResult object returned by a call to System.Net.Sockets.UdpClient.BeginReceive(System.AsyncCallback,System.Object). + /// The specified remote endpoint. + /// If successful, an array of bytes that contains datagram data. + public new byte[] EndReceive(IAsyncResult asyncResult, ref IPEndPoint? remoteEP) => base.EndReceive(asyncResult, ref remoteEP); + /// + /// Sends a UDP datagram asynchronously to a remote host. + /// + /// An array of type System.Byte that specifies the UDP datagram that you intend to send represented as an array of bytes. + /// The number of bytes in the datagram. + /// Returns System.Threading.Tasks.Task. public new async Task SendAsync(byte[] datagram, int bytes) => await base.SendAsync(datagram, bytes); } }