is there in C# SSL WebSocket Client that is .net 4.0?

断了今生、忘了曾经 提交于 2020-01-23 02:59:05

问题


I was wondering if there is anything on this subject at the moment: I have found various examples EG: the 4.5 system.net.websockets.websocket for ssl (wss://) clients in c# and I was wondering if there were any reliable ssl versions out there since this similar question was answered.

But I am developing in Visual c# 2010, a winforms C# client application that has to receive server pushes, but it's Windows 7 so I can't us net 4.5 . (Note: the emphasis on the client)

If anyone has any actual code for SSL (hopefully one that doesn't necessarily enforce the certificate authentication prompt) I would appreciate it - I prefer code samples - but I'll take a namespace solution.

Thanks in advance:-)


回答1:


So you can use .NET 4.5 in Windows 7, you just need to download the right version (on msdn.com it has the dl for Win 8) of Visual Studio.

Example connection

Example of Working with a TCP Version

General WebSocket documentation




回答2:


Websocket4net is working with SSL, we are developing a system with Jetty/websocket on server side. This is a sample snippet with authentication:

webSocket = new WebSocket("wss://host:8443/", "echo", null,
new List < KeyValuePair < string, string >> () {
    new KeyValuePair < string, string > ("Authorization", "Basic YWRtaW46YWRtaW4=")
}, "", WebSocketVersion.Rfc6455);
webSocket.EnableAutoSendPing = true;
webSocket.AllowUnstrustedCertificate = true;

The question is very old, but this answer helps others...




回答3:


I think this might work for you: http://websocket4net.codeplex.com



来源:https://stackoverflow.com/questions/13386604/is-there-in-c-sharp-ssl-websocket-client-that-is-net-4-0

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!