Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I connect to a websocket in C# with Windows 7?

I just started looking at examples for connecting to a websocket in C# and realised they all use .NET 4.5. I'm using Visual Studio 2010 in Windows 7 - are there any examples or libraries available for this?

like image 317
parsley72 Avatar asked Oct 04 '12 01:10

parsley72


People also ask

How do I connect to a WebSocket?

All you have to do is call the WebSocket constructor and pass in the URL of your server. // Create a new WebSocket. var socket = new WebSocket('ws://echo.websocket.org'); Once the connection has been established, the open event will be fired on your Web Socket instance.

Is WebSocket a TCP or HTTP?

The WebSocket protocol is an independent TCP-based protocol. Its only relationship to HTTP is that its handshake is interpreted by HTTP servers as an Upgrade request. By default the WebSocket protocol uses port 80 for regular WebSocket connections and port 443 for WebSocket connections tunneled over TLS [RFC2818].

Which language is best for WebSocket?

A WebSocket server can be written in any server-side programming language that is capable of Berkeley sockets, such as C(++), Python, PHP, or server-side JavaScript.


2 Answers

I ended up using websocket-sharp - very easy to build and use.

like image 172
parsley72 Avatar answered Oct 06 '22 18:10

parsley72


  • You can use SuperWebSocket as websocket server and Websocket4net as websocket client.
like image 26
Siuli31 Avatar answered Oct 06 '22 18:10

Siuli31