當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。