mirror of
https://github.com/thebreaddev/Supercell.GUT.git
synced 2025-04-18 11:22:35 +00:00
17 lines
401 B
C#
17 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;
|
|
}
|
|
}
|
|
}
|