private async Task OpenSocketAsync(int millisecondsTimeout) { var socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp) { NoDelay = true }; _awaitableSocket = new AwaitableSocket( new SocketAsyncEventArgs { RemoteEndPoint = new IPEndPoint(IPAddress.Parse(_host), _port) }, socket); using (var cts = new CancellationTokenSource()) { cts.CancelAfter(millisecondsTimeout); await _awaitableSocket.ConnectAsync(cts.Token); } }
public WriteBuffer(AwaitableSocket awaitableSocket) { _awaitableSocket = awaitableSocket; }
internal ReadBuffer(AwaitableSocket awaitableSocket) { _awaitableSocket = awaitableSocket; }