Poderosa.PortForwarding.Channel.StartAsyncReceive C# (CSharp) Method

StartAsyncReceive() public method

public StartAsyncReceive ( ) : void
return void
        public void StartAsyncReceive()
        {
            _socket.BeginReceive(_buffer, 0, _buffer.Length, SocketFlags.None, new AsyncCallback(this.OnSocketData), null);
        }

Usage Example

コード例 #1
0
ファイル: channel.cs プロジェクト: takano32/poderosa
 private void OnRequested(IAsyncResult r)
 {
     try {
         if (_closed)
         {
             return; //SSH切断があったときは非同期受信から戻ってくるが、EndAcceptを呼んでもObjectDisposedExceptionになるだけ
         }
         Socket local = _bindedLocalSocket.EndAccept(r);
         //Port Forwarding
         Channel newchannel = new Channel(_profile.SSHHost, local.RemoteEndPoint.ToString(), _id, null, local);
         lock (_connection) {
             SSHChannel remote = _connection.ForwardPort(newchannel, _profile.DestinationHost, _profile.DestinationPort, "localhost", 0); //!!最後の2つの引数未完
             Debug.WriteLine("OnRequested ch=" + remote.LocalChannelID);
             newchannel.FixChannel(remote);
             newchannel.StartAsyncReceive();
         }
     }
     catch (Exception ex) {
         if (!_closed)
         {
             Debug.WriteLine(ex.Message);
             Debug.WriteLine(ex.StackTrace);
             Util.InterThreadWarning(ex.Message);
         }
     }
     finally {
         if (!_closed)
         {
             _bindedLocalSocket.BeginAccept(new AsyncCallback(OnRequested), null);
             Debug.WriteLine("BeginAccept again");
         }
     }
 }
All Usage Examples Of Poderosa.PortForwarding.Channel::StartAsyncReceive