zoukankan      html  css  js  c++  java
  • Net 4.5 WebSocket 在 Windows 7, Windows 8 and Server 2012上的比较

    .Net 4.5 WebSocket Server Running on Windows 7?

    Net 4.5 WebSocket Server 可以运行在 Windows 7,但是Net 4.5的 ClientWebSocket 不支持 Windows 7,只支持 Windows 8 and Server 2012,但是可以使用第三方类库来支持Net 4.5 WebSocket 在win7,Windows 7上使用,如:

     
    下面 来自  .Net 4.5 WebSocket Server Running on Windows 7?的相关讨论,

    I know the ClientWebSocket class of .Net 4.5 is not supported on Windows 7, but is it possible to create a WebSocket server running on Windows 7 using the .Net 4.5 API?

    To make myself clearer, according to both here and here, it looks like the server side part of the .Net 4.5 WebSocket implementation should be supported even on Windows 7, yet running a HttpListener and trying to access it using an open-source WebSocket implementation got me a "Portocol not supported" error

    •  
      While it is an interesting question, it doesn't show much effort. What have you tried? According to MSDN indeed only Windows 8 and Server 2012 are supported. Do you require .NET built-in support? Otherwise there are various third-party libraries that suit your requirements. – CodeCaster Aug 22 '12 at 12:54
     
     

    The OS-level HTTP.SYS support for websockets is limited to Win8 / Windows Server 2012 - which I agree is silly (it should be part of a windows-update, or a service-pack at most, IMO).

    This means that you can't use the framework support for WebSockets from HttpListener or ASP.NET directly.

    But: as for "is it possible to create a WebSocket server" - sure... but only if you handle the TCP/IP comms yourself, or use a 3rd-party library for the same. This is a little annoying, but is not as bad as it might sound.

    Edit: after some checking, I can confirm that the server-side components for this do not work on Windows 7 (etc); the IsWebSocketRequest returns false even though it is a web-socket request with Connection: Upgrade and Upgrade: websocket (etc) headers (from a Chrome session, as it helps).

    I am, however, very surprised to find that the client-side pieces don't work, because: that is simpler and doesn't (or at least, doesn't need to) involve HTTP.SYS. Trying to use them throws a PlatformNotSupportedException.

    • 1
      @sternr I don't think they are; I think it'll error at runtime. What is even more interesting: I was under the impression that ClientWebSocket was supported on Win7 etc, since it doesn't depend on HTTP.SYS! – Marc Gravell Aug 22 '12 at 13:18
    • 1
      @sternr did some more research / testing on that; answer stands. – Marc Gravell Aug 22 '12 at 13:49
    • 7
      @sternr it is bizarre from my point of view too. I'm very disappointed by this, especially the client-side pieces. Meh, no actually I'm disappointed by the server-side pieces too. – Marc Gravell Aug 22 '12 at 13:52
    • 2
      Both the client-side and the server-side pieces depend on an OS-level component (websocket.dll), and this component only ships with Windows 8 / Server 2012. I am unsure of why this component cannot run downlevel, but the dependency explains the behavior you are seeing. – Levi Aug 24 '12 at 6:13
    • 4
      Yeah, honestly, who thinks this is really a technical issue. – Craig Dec 3 '13 at 1:58

    As Marc says, the Microsoft APIs do not work on Windows 7. However there are several open source libraries that support WebSockets on Windows 7, and in some cases even cross platform via Mono.

  • 相关阅读:
    Vue 基础篇一
    ES6常用语法
    Django的认证系统
    Django中的Form表单
    AJAX
    Django中的中间件
    Django ORM操作__聚合,分组查询
    Django ORM操作
    Luogu1382 楼房 (线段树 扫描线)
    Luogu2251 质量检测 (ST表)
  • 原文地址:https://www.cnblogs.com/1175429393wljblog/p/9952318.html
Copyright © 2011-2022 走看看