Supercell.GUT/Supercell.GUT.Server/Network/Tcp/SocketExtensions.cs

18 lines
401 B
C#
Raw Normal View History

using System.Net.Sockets;
namespace Supercell.GUT.Server.Network.Tcp;
internal static class SocketExtensions
{
public static async ValueTask<Socket?> AcceptSocketAsync(this Socket socket, CancellationToken ct)
{
try
{
return await socket.AcceptAsync(ct);
}
catch (OperationCanceledException)
{
return null;
}
}
}