Skip to content

Instantly share code, notes, and snippets.

using System.Net.Sockets;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
public class CancelableTcpClient
{
// CancellationTokenSourceをクラスレベルで保持
private readonly CancellationTokenSource _cts = new CancellationTokenSource();