iam new in websocket. I created a console application in .net 4.5 shell and create a sample websocket client using the "WebSocketSharp" library. I have the following code
using System;
using WebSocketSharp;
namespace WebsocketTest
{
class Program
{
public static void Main(string[] args)
{
try
{
using (var ws = new WebSocketSharp.WebSocket("ws://192.168.18.186:7884"))
{
Console.WriteLine("started");
ws.Connect();
ws.Send("START");
Console.ReadLine();
}
}catch(Exception ex)
{
Console.WriteLine(ex.Message);
Console.ReadLine();
}
}
}
}
But I cannot create a connection to my websocket server running on another machine. I got an error like this
09-05-2017 16:20:41|Fatal|WebSocket.connect:0|System.Net.Sockets.SocketException (0x80004005): No connection could be made because the target machine actively refused it 192.168.18.186:7884
at System.Net.Sockets.TcpClient..ctor(String hostname, Int32 port)
at WebSocketSharp.WebSocket.setClientStream()
at WebSocketSharp.WebSocket.doHandshake()
at WebSocketSharp.WebSocket.connect()
What is the problem with my code? are there any good web layout libraries?
source
share