Пример #1
0
 public void OnWrite(BaseSocket sock, byte[] buf, int offset, int length)
 {
     System.Diagnostics.Debug.WriteLine(ENC.GetString(buf, offset, length));
     sock.Close();
 }
Пример #2
0
 /// <summary>
 /// Close the socket.  This is NOT async.  .Net doesn't have async closes.
 /// But, it can be *called* async, particularly from GotData.
 /// Attempts to do a shutdown() first.
 /// </summary>
 public override void Close()
 {
     m_sock.Close();
 }
Пример #3
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;
 }
Пример #4
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;
        }