kerryjiang / WebSocket4Net

A popular .NET WebSocket Client
752 stars 272 forks source link

Not Reciving anything #112

Open BubbaSWalter opened 6 years ago

BubbaSWalter commented 6 years ago

using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using WebSocket4Net;

namespace WindowsFormsApp1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } WebSocket websocket; private void Form1_Load(object sender, EventArgs e) { Console.WriteLine("WriteLine");

        WebSocket websocket = new WebSocket("ws://localhost:2012/");
        websocket.Opened += new EventHandler(websocket_Opened);
        websocket.MessageReceived += new EventHandler<MessageReceivedEventArgs>(websocket_MessageReceived);
        websocket.Open();

    }
    private void websocket_Opened(object sender, EventArgs e)
    {
        Console.WriteLine("Message Sent");
        websocket.Send("Hello World");
    }
    private void websocket_MessageReceived(object sender, EventArgs e)
    {

    }
}

}

I should i theory at least get a message No host detected