/// <summary>
 /// Attempt to receive a string from <paramref name="socket"/>, and decode using <see cref="SendReceiveConstants.DefaultEncoding"/>.
 /// If no message is available within <paramref name="timeout"/>, return <c>false</c>.
 /// </summary>
 /// <param name="socket">The socket to receive from.</param>
 /// <param name="timeout">The maximum period of time to wait for a message to become available.</param>
 /// <param name="str">The conent of the received message, or <c>null</c> if no message was available.</param>
 /// <param name="cancellationToken">The token to monitor for cancellation requests. The default value is <see cref="CancellationToken.None"/>.</param>
 /// <returns><c>true</c> if a message was available, otherwise <c>false</c>.</returns>
 /// <remarks>The method would return false if cancellation has had requested.</remarks>
 public static bool TryReceiveString(this IThreadSafeInSocket socket, TimeSpan timeout, [NotNullWhen(returnValue: true)] out string?str,
                                     CancellationToken cancellationToken = default)
 {
     return(socket.TryReceiveString(timeout, SendReceiveConstants.DefaultEncoding, out str, cancellationToken));
 }
 /// <summary>
 /// Attempt to receive a string from <paramref name="socket"/>, and decode using <paramref name="encoding"/>.
 /// If no message is immediately available, return <c>false</c>.
 /// </summary>
 /// <param name="socket">The socket to receive from.</param>
 /// <param name="encoding">The encoding used to convert the data to a string.</param>
 /// <param name="str">The content of the received message, or <c>null</c> if no message was available.</param>
 /// <returns><c>true</c> if a message was available, otherwise <c>false</c>.</returns>
 public static bool TryReceiveString(this IThreadSafeInSocket socket, Encoding encoding,
                                     [NotNullWhen(returnValue: true)] out string?str)
 {
     return(socket.TryReceiveString(TimeSpan.Zero, encoding, out str));
 }