4

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:-)

Community
  • 1
  • 1
conners
  • 1,420
  • 4
  • 18
  • 28
  • 1
    .NET 4.5 is available for Windows 7. – Greg Nov 14 '12 at 20:20
  • Running? yes Compiling? No. http://social.msdn.microsoft.com/Forums/en-US/async/thread/929ccd95-0ab1-4c2b-b153-091471965bc3/ – conners Nov 14 '12 at 20:34
  • @conners why can you not use VS Express 2012? – Brad Semrad Nov 14 '12 at 20:38
  • it's not for Windows 8, no one is using Windows 8 yet – conners Nov 14 '12 at 20:39
  • 2
    I can compile (using VS 2012) and run .NET 4.5 applications on Windows 7. Those applications will also run on Windows Vista and Windows 8. What restrictions do you have preventing you from doing the same? We need to be very clear here, because imprecise communication causes confusion. – Greg Nov 14 '12 at 20:41
  • I have Microsoft Visual C# 2010 Express Edition, I think I need to use Professional 2012 or higher for what you are referring to. – conners Nov 14 '12 at 20:44
  • 1
    @connors - No you need Express for Windows Desktop - http://www.microsoft.com/visualstudio/eng/products/visual-studio-express-for-windows-desktop#product-express-desktop-details – Brad Semrad Nov 14 '12 at 20:45
  • I thought VS 2012 Express Edition Requires Windows 8 to be used. I am using Windows 7 to run, compile etc and it will be for the Windows 7 platform – conners Nov 14 '12 at 20:46
  • @conners Under the system requirements - Supported operating systems Windows 7 SP1 (x86 and x64) (http://www.microsoft.com/visualstudio/eng/products/visual-studio-express-for-windows-desktop#product-express-desktop-requirements) – Brad Semrad Nov 14 '12 at 20:48
  • weird, you're right (and it's installing) I tried this line of thought to death about 20 days ago and (I was sure) it was Windows 8 only.. I even tried VB and c# downloads and every which way.. oh well thank you.. PS: do you know of a code EXAMPLE of wss:// in system.net.websockets.websocket – conners Nov 14 '12 at 20:51
  • @conners: you probably thought that because they are two VS2012 express - one "for Windows 8" and one "for Windows Desktop". – Julien Lebosquain Nov 14 '12 at 20:58

3 Answers3

6

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...

Tushar Gupta - curioustushar
  • 58,085
  • 24
  • 103
  • 107
crazyman
  • 979
  • 8
  • 8
  • I did a quick Google for Websocket4net and found two projects. Is it the one at CodePlex: http://websocket4net.codeplex.com/ or the one on GitHub: https://github.com/kerryjiang/WebSocket4Net ? – Kevin Aug 02 '13 at 16:41
3

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

Brad Semrad
  • 1,501
  • 1
  • 11
  • 19
  • many many thanks for the tip, (and links) RE: upgrading to VS 2012 in Windows 7 – conners Nov 14 '12 at 20:59
  • I know this is bit old answer, I tried downloading the VS2012 for desktop express edition but could add reference to System.Net.WebSockets.WebSocket . It still seems that it is only supported in Windows 8. Any pointers would be helpful. Thanks... – Manoj Oct 15 '13 at 14:08
0

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

Burucsb
  • 35
  • 1
  • 7
  • thank you, I was aware of this before but it's beta: also is that SSL? I can't see any examples where it specifically says "wss://" (preferably self-signed SSL) – conners Nov 14 '12 at 20:58
  • @conners Just to be pedantic, I'd say it's preferably with a non self-signed cert, and only if you have to fallback to using a self-signed one; only cos they are falling out of (trusted/permitted) favour. – DennisVM-D2i Jun 29 '22 at 18:28