我有以下功能
public static Task<int> SendTaskAsync(this Socket socket, byte[] buffer, int offset, int size, SocketFlags flags)
{
AsyncCallback nullOp = (i) => { };
IAsyncResult result = socket.BeginSend(buffer, offset, size, flags, nullOp, socket);
// Use overload that takes an IAsyncResult directly
return Task.Factory.FromAsync(result, socket.EndSend);
}
但是我得到了一个
“无法从组中选择方法”
FromAsync 上的错误。我的代码应该如何?我对 TAP 很陌生