mirror of
https://github.com/thebreaddev/Supercell.GUT.git
synced 2024-11-14 01:14:37 +00:00
18 lines
401 B
C#
18 lines
401 B
C#
|
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;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|