Closed
Description
openedon Apr 23, 2019
CancellationTokens were added to SendAsync and ReceiveAsync in PR dotnet/corefx#36516
This for adding overloads to ConnectAsync and AcceptAsync:
class SocketTaskExtensions
{
public static ValueTask ConnectAsync (this Socket socket, EndPoint remoteEP, CancellationToken cancellationToken);
public static ValueTask ConnectAsync (this Socket socket, IPAddress address, int port, CancellationToken cancellationToken);
public static ValueTask ConnectAsync (this Socket socket, IPAddress[] addresses, int port, CancellationToken cancellationToken);
public static ValueTask ConnectAsync (this Socket socket, string host, int port, CancellationToken cancellationToken);
public static ValueTask<Socket> AcceptAsync (this Socket socket, CancellationToken cancellationToken);
public static ValueTask<Socket> AcceptAsync (this Socket socket, Socket acceptSocket, CancellationToken cancellationToken);
// existing methods:
// public static Task ConnectAsync (this Socket socket, EndPoint remoteEP);
// public static Task ConnectAsync (this Socket socket, IPAddress address, int port);
// public static Task ConnectAsync (this Socket socket, IPAddress[] addresses, int port);
// public static Task ConnectAsync (this Socket socket, string host, int port);
// public static Task<Socket> AcceptAsync (this Socket socket);
// public static Task<Socket> AcceptAsync (this Socket socket, Socket acceptSocket);
}
class Socket
{
public static void CancelAcceptAsync(SocketAsyncEventArgs e);
// existing methods:
// public bool AcceptAsync (SocketAsyncEventArgs e);
// public bool ConnectAsync (SocketAsyncEventArgs e);
// public static void CancelConnectAsync (SocketAsyncEventArgs e);
}
class TcpClient
{
public ValueTask ConnectAsync (string host, int port, CancellationToken cancellationToken);
public ValueTask ConnectAsync (IPAddress address, int port, CancellationToken cancellationToken);
public ValueTask ConnectAsync (IPAddress[] addresses, int port, CancellationToken cancellationToken);
// existing methods:
// public Task ConnectAsync (string host, int port);
// public Task ConnectAsync (IPAddress address, int port);
// public Task ConnectAsync (IPAddress[] addresses, int port);
}
class TcpListener
{
public ValueTask<Socket> AcceptSocketAsync (CancellationToken cancellationToken);
public ValueTask<TcpClient> AcceptTcpClientAsync (CancellationToken cancellationToken);
// existing methods:
// public Task<Socket> AcceptSocketAsync ();
// public Task<TcpClient> AcceptTcpClientAsync ();
}
CC @stephentoub
Activity