Esempio n. 1
0
 public void Transmit(ByteDataFragment data)
 {
     if (_socket.Connected)
     {
         _socket.Send(data.Buffer, data.Offset, data.Length, SocketFlags.None);
     }
 }
Esempio n. 2
0
 public PlainPoderosaSocket(Socket s)
 {
     _socket       = s;
     _buf          = new byte[4096]; //ProtocolsPlugin.Instance.ProtocolOptions.SocketBufferSize
     _dataFragment = new ByteDataFragment(_buf, 0, 0);
     _callbackRoot = new AsyncCallback(RepeatCallback);
 }
Esempio n. 3
0
 public void OnReception(ByteDataFragment data)
 {
     ProcessBuffer(data);
     if (!_parent.IsClosed)
     {
         _negotiator.Flush(_parent.RawSocket);
     }
 }
Esempio n. 4
0
        //IByteAsyncInputStream‚̃nƒ“ƒhƒ‰‚Å—áŠO‚ª—ˆ‚é‚Æ‚¯‚Á‚±‚¤ŽSŽ–‚È‚Ì‚Å‚±‚Ì’†‚Å‚µ‚Á‚©‚èƒK[ƒh

        private GenericResult OnReceptionCore(ByteDataFragment data)
        {
            try {
                _callback.OnReception(_dataFragment);
                return(GenericResult.Succeeded);
            }
            catch (Exception ex) {
                RuntimeUtil.ReportException(ex);
                Close();
                return(GenericResult.Failed);
            }
        }
 public void Transmit(ByteDataFragment data)
 {
     if (_monitors != null)
     {
         ResetEnumerator();
         while (_enumerator.MoveNext())
         {
             _enumerator.Current.Transmit(data);
         }
     }
     _transmitter.Transmit(data);
 }
        public void OnReception(ByteDataFragment data)
        {
            if (_monitors != null)
            {
                ResetEnumerator();
                while (_enumerator.MoveNext())
                {
                    _enumerator.Current.OnReception(data);
                }
            }

            _receiver.OnReception(data);
        }
Esempio n. 7
0
        //CR NUL -> CR •ÏŠ·‚¨‚æ‚Ñ IAC‚©‚ç‚Í‚¶‚Ü‚éƒV[ƒPƒ“ƒX‚̏ˆ—
        private void ProcessBuffer(ByteDataFragment data)
        {
            int limit  = data.Offset + data.Length;
            int offset = data.Offset;

            byte[] buf = data.Buffer;
            //Debug.WriteLine(String.Format("Telnet len={0}, proc={1}", data.Length, _negotiator.InProcessing));

            while (offset < limit)
            {
                while (offset < limit && _negotiator.InProcessing)
                {
                    if (_negotiator.Process(buf[offset++]) == TelnetNegotiator.ProcessResult.REAL_0xFF)
                    {
                        _callback.OnReception(_localdata.Set(buf, offset - 1, 1));
                    }
                }

                int delim = offset;
                while (delim < limit)
                {
                    byte b = buf[delim];
                    if (b == 0xFF)
                    {
                        _negotiator.StartNegotiate();
                        break;
                    }
                    if (b == 0 && delim - 1 >= 0 && buf[delim - 1] == 0x0D)
                    {
                        break;                                                              //CR NULƒTƒ|[ƒg
                    }
                    delim++;
                }

                if (delim > offset)
                {
                    _callback.OnReception(_localdata.Set(buf, offset, delim - offset));                            //delim‚ÌŽè‘O‚܂ŏˆ—
                }
                offset = delim + 1;
            }
        }
Esempio n. 8
0
 public void Transmit(ByteDataFragment data)
 {
     Transmit(data.Buffer, data.Offset, data.Length);
 }
Esempio n. 9
0
 public TelnetReceiver(TelnetTerminalConnection parent, TelnetNegotiator negotiator)
 {
     _parent     = parent;
     _negotiator = negotiator;
     _localdata  = new ByteDataFragment();
 }
Esempio n. 10
0
 public void Transmit(ByteDataFragment data)
 {
     _receiver.OnReception(data);
 }
Esempio n. 11
0
        private MemoryStream _buffer; //RepeatAsyncRead‚ªŒÄ‚΂ê‚é‘O‚ÉŽóM‚µ‚Ä‚µ‚Ü‚Á‚½ƒf[ƒ^‚ðˆêŽž•ÛŠÇ‚·‚éƒoƒbƒtƒ@

        public SSHSocket(SSHTerminalConnection parent) : base(parent)
        {
            _data = new ByteDataFragment();
        }