本文整理汇总了C#中bedrock.net.BaseSocket类的典型用法代码示例。如果您正苦于以下问题:C# BaseSocket类的具体用法?C# BaseSocket怎么用?C# BaseSocket使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BaseSocket类属于bedrock.net命名空间,在下文中一共展示了BaseSocket类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: GetListener
public ISocketEventListener GetListener(BaseSocket new_sock)
{
return this;
}
开发者ID:rankida,项目名称:HangoutPhone,代码行数:4,代码来源:AsyncSocketTest.cs
示例17: OnInit
/// <summary>
/// An accept socket is about to be bound, or a connect socket is about to connect,
/// or an incoming socket just came in. Use this as an opportunity to
/// </summary>
/// <param name="newSock">The new socket that is about to be connected.</param>
public virtual void OnInit(BaseSocket newSock)
{
}
开发者ID:bladecoding,项目名称:Jabber-net,代码行数:8,代码来源:SocketEventListener.cs
示例18: GetListener
/// <summary>
///
/// </summary>
/// <param name="newSock"></param>
/// <returns></returns>
public virtual ISocketEventListener GetListener(BaseSocket newSock)
{
return m_listener.GetListener(newSock);
}
开发者ID:krbysn,项目名称:jabber-net,代码行数:9,代码来源:ProxySocket.cs
示例19: OnRead
/// <summary>
/// Bytes were read from the socket.
/// </summary>
/// <param name="sock">The socket that was read from.</param>
/// <param name="buf">The bytes that were read.</param>
/// <returns>true if RequestRead() should be called automatically again</returns>
/// <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 bool OnRead(BaseSocket sock, byte[] buf, int offset, int length)
{
return true;
}
开发者ID:bladecoding,项目名称:Jabber-net,代码行数:12,代码来源:SocketEventListener.cs
示例20: OnConnect
/// <summary>
///
/// </summary>
/// <param name="sock"></param>
public virtual void OnConnect(BaseSocket sock)
{
if (m_ssl)
{
#if !NO_SSL
m_sock.StartTLS();
#else
throw new NotImplementedException("SSL not compiled in");
#endif
}
m_listener.OnConnect(sock);
}
开发者ID:krbysn,项目名称:jabber-net,代码行数:16,代码来源:ProxySocket.cs
注:本文中的bedrock.net.BaseSocket类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论