本文整理汇总了C#中Microsoft.AspNet.Server.Kestrel.Networking.UvStreamHandle.Accept方法的典型用法代码示例。如果您正苦于以下问题:C# UvStreamHandle.Accept方法的具体用法?C# UvStreamHandle.Accept怎么用?C# UvStreamHandle.Accept使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.AspNet.Server.Kestrel.Networking.UvStreamHandle
的用法示例。
在下文中一共展示了UvStreamHandle.Accept方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnConnection
/// <summary>
/// Handles an incoming connection
/// </summary>
/// <param name="listenSocket">Socket being used to listen on</param>
/// <param name="status">Connection status</param>
protected override void OnConnection(UvStreamHandle listenSocket, int status)
{
var acceptSocket = new UvPipeHandle(Log);
acceptSocket.Init(Thread.Loop, false);
try
{
listenSocket.Accept(acceptSocket);
}
catch (UvException ex)
{
Log.LogError("PipeListener.OnConnection", ex);
return;
}
DispatchConnection(acceptSocket);
}
示例2: OnConnection
/// <summary>
/// Handles an incoming connection
/// </summary>
/// <param name="listenSocket">Socket being used to listen on</param>
/// <param name="status">Connection status</param>
protected override void OnConnection(UvStreamHandle listenSocket, int status)
{
var acceptSocket = new UvTcpHandle(Log);
acceptSocket.Init(Thread.Loop, Thread.QueueCloseHandle);
try
{
listenSocket.Accept(acceptSocket);
}
catch (UvException ex)
{
Log.LogError("TcpListenerPrimary.OnConnection", ex);
return;
}
DispatchConnection(acceptSocket);
}
示例3: OnListenPipe
private void OnListenPipe(UvStreamHandle pipe, int status, Exception error, object state)
{
if (status < 0)
{
return;
}
var dispatchPipe = new UvPipeHandle();
dispatchPipe.Init(Thread.Loop, true);
try
{
pipe.Accept(dispatchPipe);
}
catch (Exception)
{
dispatchPipe.Dispose();
return;
}
_dispatchPipes.Add(dispatchPipe);
}
示例4: OnListenPipe
private void OnListenPipe(UvStreamHandle pipe, int status, Exception error)
{
if (status < 0)
{
return;
}
var dispatchPipe = new UvPipeHandle(Log);
dispatchPipe.Init(Thread.Loop, true);
try
{
pipe.Accept(dispatchPipe);
}
catch (UvException ex)
{
dispatchPipe.Dispose();
Log.LogError("ListenerPrimary.OnListenPipe", ex);
return;
}
_dispatchPipes.Add(dispatchPipe);
}
示例5: OnConnection
private void OnConnection(UvStreamHandle listenSocket, int status)
{
var acceptSocket = new UvTcpHandle();
acceptSocket.Init(Thread.Loop, Thread.QueueCloseHandle);
listenSocket.Accept(acceptSocket);
var connection = new Connection(this, acceptSocket);
connection.Start();
}