is there in C# SSL WebSocket Client that is .net 4

2019-04-14 03:29发布

问题:

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