當前位置: 首頁>>代碼示例>>C#>>正文


C# net.BaseSocket類代碼示例

本文整理匯總了C#中bedrock.net.BaseSocket的典型用法代碼示例。如果您正苦於以下問題:C# BaseSocket類的具體用法?C# BaseSocket怎麽用?C# BaseSocket使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


BaseSocket類屬於bedrock.net命名空間,在下文中一共展示了BaseSocket類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: OnInvalidCertificate

 public bool OnInvalidCertificate(BaseSocket sock,
     System.Security.Cryptography.X509Certificates.X509Certificate certificate,
     System.Security.Cryptography.X509Certificates.X509Chain chain,
     System.Net.Security.SslPolicyErrors sslPolicyErrors)
 {
     return false;
 }
開發者ID:rankida,項目名稱:HangoutPhone,代碼行數:7,代碼來源:AsyncSocketTest.cs

示例2: OnError

 public void OnError(BaseSocket sock, Exception ex)
 {
     lock (done)
     {
         succeeded = false;
         errorMessage = ex.Message;
         Monitor.Pulse(done);
     }
 }
開發者ID:rankida,項目名稱:HangoutPhone,代碼行數:9,代碼來源:AsyncSocketTest.cs

示例3: OnRead

            public bool OnRead(BaseSocket sock, byte[] buf, int offset, int length)
            {
                string str = ENC.GetString(buf, offset, length);
                Console.WriteLine("SR: " + str);
                if (str.Contains("11111"))
                {
                sock.Write(ENC.GetBytes(@"HTTP/1.1 200 OK
Content-Length: 10
Content-Type: text/plain

1234567890"));
                }
                else if (str.Contains("22222"))
                {
                    sock.Write(ENC.GetBytes(@"HTTP/1.1 200 OK
Content-Length: 10
Content-Type: text/plain

12345"));
                    sock.Write(ENC.GetBytes("67890"));
                }
                else if (str.Contains("33333"))
                {
                    sock.Write(ENC.GetBytes(@"HTTP/1.1 200 OK
Content-Length: 20
Content-Type: text/plain

12345"));
                    // Turning off Nagle didn't fix this.  Mrmph.
                    Thread.Sleep(300);
                    sock.Write(ENC.GetBytes("67890"));
                    Thread.Sleep(300);
                    sock.Write(ENC.GetBytes("12345"));
                    Thread.Sleep(300);
                    sock.Write(ENC.GetBytes("67890"));
                }
                return true;
            }
開發者ID:krbysn,項目名稱:jabber-net,代碼行數:38,代碼來源:HttpSocketTest.cs

示例4: OnConnect

 /// <summary>
 /// Outbound connection was connected.
 /// </summary>
 /// <param name="sock">Connected socket.</param>
 public virtual void OnConnect(BaseSocket sock)
 {
 }
開發者ID:bladecoding,項目名稱:Jabber-net,代碼行數:7,代碼來源:SocketEventListener.cs

示例5: OnError

 /// <summary>
 /// An error happened in processing.  The socket is no longer open.
 /// </summary>
 /// <param name="sock">Socket in error</param>
 /// <param name="ec">Exception that caused the error</param>
 public virtual void OnError(BaseSocket sock, System.Exception ec)
 {
 }
開發者ID:bladecoding,項目名稱:Jabber-net,代碼行數:8,代碼來源:SocketEventListener.cs

示例6: OnWrite

 /// <summary>
 ///
 /// </summary>
 /// <param name="sock"></param>
 /// <param name="buf"></param>
 /// <param name="offset"></param>
 /// <param name="length"></param>
 public virtual void OnWrite(BaseSocket sock, byte[] buf, int offset, int length)
 {
     m_listener.OnWrite(sock, buf, offset, length);
 }
開發者ID:krbysn,項目名稱:jabber-net,代碼行數:11,代碼來源:ProxySocket.cs

示例7:

 void ISocketEventListener.OnInit(BaseSocket newSock)
 {
 }
開發者ID:bladecoding,項目名稱:Jabber-net,代碼行數:3,代碼來源:SocketStanzaStream.cs

示例8: OnWrite

 public void OnWrite(BaseSocket sock, byte[] buf, int offset, int length)
 {
     System.Diagnostics.Debug.WriteLine(ENC.GetString(buf, offset, length));
     sock.Close();
 }
開發者ID:rankida,項目名稱:HangoutPhone,代碼行數:5,代碼來源:AsyncSocketTest.cs

示例9: OnError

 /// <summary>
 ///
 /// </summary>
 /// <param name="sock"></param>
 /// <param name="ex"></param>
 public virtual void OnError(BaseSocket sock, System.Exception ex)
 {
     m_listener.OnError(sock, ex);
 }
開發者ID:krbysn,項目名稱:jabber-net,代碼行數:9,代碼來源:ProxySocket.cs

示例10: OnInit

 public void OnInit(BaseSocket new_sock)
 {
 }
開發者ID:rankida,項目名稱:HangoutPhone,代碼行數:3,代碼來源:AsyncSocketTest.cs

示例11: OnWrite

 /// <summary>
 /// Bytes were written to the socket.
 /// </summary>
 /// <param name="sock">The socket that was written to.</param>
 /// <param name="buf">The bytes that were written.</param>
 /// <param name="offset">Offset into the buffer to start at</param>
 /// <param name="length">Number of bytes to use out of the buffer</param>
 public virtual void OnWrite(BaseSocket sock, byte[] buf, int offset, int length)
 {
 }
開發者ID:bladecoding,項目名稱:Jabber-net,代碼行數:10,代碼來源:SocketEventListener.cs

示例12: OnConnect

 public void OnConnect(BaseSocket sock)
 {
     sock.Write(sbuf, 5, 10);
 }
開發者ID:rankida,項目名稱:HangoutPhone,代碼行數:4,代碼來源:AsyncSocketTest.cs

示例13: catch

        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;
        }
開發者ID:bladecoding,項目名稱:Jabber-net,代碼行數:19,代碼來源:SocketStanzaStream.cs

示例14: OnClose

 public void OnClose(BaseSocket sock)
 {
 }
開發者ID:rankida,項目名稱:HangoutPhone,代碼行數:3,代碼來源:AsyncSocketTest.cs

示例15: OnAccept

 public bool OnAccept(BaseSocket newsocket)
 {
     newsocket.RequestRead();
     return false;
 }
開發者ID:rankida,項目名稱:HangoutPhone,代碼行數:5,代碼來源:AsyncSocketTest.cs


注:本文中的bedrock.net.BaseSocket類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。