Ejemplo n.º 1
0
        /// <summary>
        /// Quit this FTP session and clean up.
        /// </summary>
        internal virtual void Logout()
        {
            SystemException ex = null;

            try
            {
                writer.Close();
            }
            catch (SystemException e)
            {
                ex = e;
            }
            try
            {
                reader.Close();
            }
            catch (SystemException e)
            {
                ex = e;
            }
            try
            {
                controlSock.Close();
            }
            catch (SystemException e)
            {
                ex = e;
            }
            if (ex != null)
            {
                throw ex;
            }
        }
Ejemplo n.º 2
0
 internal void Kill()
 {
     try
     {
         if (controlSock != null)
         {
             controlSock.Close();
         }
         controlSock = null;
     }
     catch (Exception e)
     {
         log.Debug("Killed socket", e);
     }
     log.Info("Killed control socket");
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Closes the socket connection.
 /// </summary>
 /// <param name="clean">Sends the stream:stream close packet if true.</param>
 public override void Close(bool clean)
 {
     // TODO: socket should still be connected, excepts for races.  Revist.
     if (clean)
     {
         Write("</stream:stream>");
     }
     m_sock.Close();
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Closes underlying sockets
 /// </summary>
 internal override void Close()
 {
     if (acceptedSock != null)
     {
         acceptedSock.Close();
         acceptedSock = null;
     }
     sock.Close();
 }
Ejemplo n.º 5
0
 public bool OnRead(BaseSocket sock, byte[] buf, int offset, int length)
 {
     success = ENC.GetString(buf, offset, length);
     sock.Close();
     lock (done)
     {
         Monitor.Pulse(done);
     }
     return(false);
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Closes underlying sockets
 /// </summary>
 internal override void Close()
 {
     try
     {
         if (acceptedSock != null)
         {
             acceptedSock.Close();
             acceptedSock = null;
         }
     }
     finally
     {
         sock.Close();
     }
 }
Ejemplo n.º 7
0
        bool ISocketEventListener.OnRead(BaseSocket sock, byte[] buf, int offset, int length)
        {
            int tim = (int)m_listener[Options.KEEP_ALIVE];

            if (tim > 0)
            {
                m_timer.Change(tim, tim);
            }

            m_listener.BytesRead(buf, offset, length);
            try
            {
                m_elements.Push(buf, offset, length);
            }
            catch (Exception e)
            {
                ((ISocketEventListener)this).OnError(sock, e);
                sock.Close();
                return(false);
            }
            return(true);
        }
Ejemplo n.º 8
0
 public void OnWrite(BaseSocket sock, byte[] buf, int offset, int length)
 {
     System.Diagnostics.Debug.WriteLine(ENC.GetString(buf, offset, length));
     sock.Close();
 }