.Net 4.5 WebSocket Server Running on Windows 7?
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.
- https://github.com/statianzo/Fleck
- http://vtortola.github.io/WebSocketListener/
- http://superwebsocket.codeplex.com/
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
.