当前位置: 首页>>代码示例>>C#>>正文


C# Networking.UvLoopHandle类代码示例

本文整理汇总了C#中Microsoft.AspNet.Server.Kestrel.Networking.UvLoopHandle的典型用法代码示例。如果您正苦于以下问题:C# UvLoopHandle类的具体用法?C# UvLoopHandle怎么用?C# UvLoopHandle使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


UvLoopHandle类属于Microsoft.AspNet.Server.Kestrel.Networking命名空间,在下文中一共展示了UvLoopHandle类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SocketCanListenAndAccept

 public async Task SocketCanListenAndAccept()
 {
     var loop = new UvLoopHandle(_logger);
     loop.Init(_uv);
     var tcp = new UvTcpHandle(_logger);
     tcp.Init(loop);
     var address = ServerAddress.FromUrl("http://localhost:54321/");
     tcp.Bind(address);
     tcp.Listen(10, (stream, status, error, state) =>
     {
         var tcp2 = new UvTcpHandle(_logger);
         tcp2.Init(loop);
         stream.Accept(tcp2);
         tcp2.Dispose();
         stream.Dispose();
     }, null);
     var t = Task.Run(async () =>
     {
         var socket = new Socket(
             AddressFamily.InterNetwork,
             SocketType.Stream,
             ProtocolType.Tcp);
         await Task.Factory.FromAsync(
             socket.BeginConnect,
             socket.EndConnect,
             new IPEndPoint(IPAddress.Loopback, 54321),
             null,
             TaskCreationOptions.None);
         socket.Dispose();
     });
     loop.Run();
     loop.Dispose();
     await t;
 }
开发者ID:Starcounter,项目名称:KestrelHttpServer,代码行数:34,代码来源:NetworkingTests.cs

示例2: Init

 public void Init(UvLoopHandle loop)
 {
     CreateMemory(
         loop.Libuv,
         loop.ThreadId,
         loop.Libuv.req_size(Libuv.RequestType.SHUTDOWN));
 }
开发者ID:njmube,项目名称:KestrelHttpServer,代码行数:7,代码来源:UvShutdownReq.cs

示例3: LoopCanBeInitAndClose

 public async Task LoopCanBeInitAndClose()
 {
     var loop = new UvLoopHandle();
     loop.Init(_uv);
     loop.Run();
     loop.Dispose();
 }
开发者ID:njmube,项目名称:KestrelHttpServer,代码行数:7,代码来源:NetworkingTests.cs

示例4: LoopCanBeInitAndClose

 public void LoopCanBeInitAndClose()
 {
     var loop = new UvLoopHandle(_logger);
     loop.Init(_uv);
     loop.Run();
     loop.Dispose();
 }
开发者ID:leloulight,项目名称:KestrelHttpServer,代码行数:7,代码来源:NetworkingTests.cs

示例5: KestrelThread

 public KestrelThread(KestrelEngine engine)
 {
     _engine = engine;
     _loop = new UvLoopHandle();
     _post = new UvAsyncHandle();
     _thread = new Thread(ThreadStart);
     QueueCloseHandle = PostCloseHandle;
 }
开发者ID:stevenliujw,项目名称:KestrelHttpServer,代码行数:8,代码来源:KestrelThread.cs

示例6: Init

 public void Init(UvLoopHandle loop)
 {
     var requestSize = loop.Libuv.req_size(Libuv.RequestType.CONNECT);
     CreateMemory(
         loop.Libuv,
         loop.ThreadId,
         requestSize);
 }
开发者ID:leloulight,项目名称:KestrelHttpServer,代码行数:8,代码来源:UvConnectRequest.cs

示例7: Init

        public void Init(UvLoopHandle loop, Action<Action<IntPtr>, IntPtr> queueCloseHandle)
        {
            CreateHandle(
                loop.Libuv,
                loop.ThreadId,
                loop.Libuv.handle_size(Libuv.HandleType.TCP), queueCloseHandle);

            _uv.tcp_init(loop, this);
        }
开发者ID:rogeralsing,项目名称:KestrelHttpServer,代码行数:9,代码来源:UvTcpHandle.cs

示例8: Init

        public void Init(UvLoopHandle loop, bool ipc)
        {
            CreateMemory(
                loop.Libuv,
                loop.ThreadId, 
                loop.Libuv.handle_size(Libuv.HandleType.NAMED_PIPE));

            _uv.pipe_init(loop, this, ipc);
        }
开发者ID:leloulight,项目名称:KestrelHttpServer,代码行数:9,代码来源:UvPipeHandle.cs

示例9: Init

 public void Init(UvLoopHandle loop)
 {
     var requestSize = loop.Libuv.req_size(Libuv.RequestType.WRITE);
     var bufferSize = Marshal.SizeOf<Libuv.uv_buf_t>() * BUFFER_COUNT;
     CreateMemory(
         loop.Libuv,
         loop.ThreadId,
         requestSize + bufferSize);
     _bufs = handle + requestSize;
 }
开发者ID:justkao,项目名称:KestrelHttpServer,代码行数:10,代码来源:UvWriteReq.cs

示例10: Init

        public void Init(UvLoopHandle loop, Action callback)
        {
            CreateMemory(
                loop.Libuv, 
                loop.ThreadId, 
                loop.Libuv.handle_size(Libuv.HandleType.ASYNC));

            _callback = callback;
            _uv.async_init(loop, this, _uv_async_cb);
        }
开发者ID:Starcounter,项目名称:KestrelHttpServer,代码行数:10,代码来源:UvAsyncHandle.cs

示例11: SocketCanBeInitAndClose

 public void SocketCanBeInitAndClose()
 {
     var loop = new UvLoopHandle(_logger);
     loop.Init(_uv);
     var tcp = new UvTcpHandle(_logger);
     tcp.Init(loop);
     tcp.Bind("localhost", 0);
     tcp.Dispose();
     loop.Run();
     loop.Dispose();
 }
开发者ID:rogeralsing,项目名称:KestrelHttpServer,代码行数:11,代码来源:NetworkingTests.cs

示例12: SocketCanBeInitAndClose

 public async Task SocketCanBeInitAndClose()
 {
     var loop = new UvLoopHandle();
     loop.Init(_uv);
     var tcp = new UvTcpHandle();
     tcp.Init(loop);
     tcp.Bind(new IPEndPoint(IPAddress.Loopback, 0));
     tcp.Dispose();
     loop.Run();
     loop.Dispose();
 }
开发者ID:njmube,项目名称:KestrelHttpServer,代码行数:11,代码来源:NetworkingTests.cs

示例13: KestrelThread

 public KestrelThread(KestrelEngine engine)
 {
     _engine = engine;
     _appLifetime = engine.AppLifetime;
     _log = engine.Log;
     _threadPool = engine.ThreadPool;
     _loop = new UvLoopHandle(_log);
     _post = new UvAsyncHandle(_log);
     _thread = new Thread(ThreadStart);
     _thread.Name = "KestrelThread - libuv";
     QueueCloseHandle = PostCloseHandle;
 }
开发者ID:leloulight,项目名称:KestrelHttpServer,代码行数:12,代码来源:KestrelThread.cs

示例14: SocketCanBeInitAndClose

 public void SocketCanBeInitAndClose()
 {
     var loop = new UvLoopHandle(_logger);
     loop.Init(_uv);
     var tcp = new UvTcpHandle(_logger);
     tcp.Init(loop);
     var address = ServerAddress.FromUrl("http://localhost:0/");
     tcp.Bind(address);
     tcp.Dispose();
     loop.Run();
     loop.Dispose();
 }
开发者ID:leloulight,项目名称:KestrelHttpServer,代码行数:12,代码来源:NetworkingTests.cs

示例15: InitAndCloseServerPipe

        public void InitAndCloseServerPipe()
        {
            var loop = new UvLoopHandle();
            var pipe = new UvPipeHandle();

            loop.Init(_uv);
            pipe.Init(loop, true);
            pipe.Bind(@"\\.\pipe\InitAndCloseServerPipe");
            pipe.Dispose();

            loop.Run();

            pipe.Dispose();
            loop.Dispose();
        }
开发者ID:justkao,项目名称:KestrelHttpServer,代码行数:15,代码来源:MultipleLoopTests.cs


注:本文中的Microsoft.AspNet.Server.Kestrel.Networking.UvLoopHandle类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。