1232112323
This commit is contained in:
58
Form1.cs
Normal file
58
Form1.cs
Normal file
@ -0,0 +1,58 @@
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
using Fleck;
|
||||
|
||||
namespace SupperWebSocket
|
||||
{
|
||||
public partial class Form1 : Form
|
||||
{
|
||||
public Form1()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private WebSocketServer _webSocketServer;
|
||||
|
||||
private void Form1_Load(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void button1_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (button1.Text == "<22><><EFBFBD><EFBFBD>Socket<65><74><EFBFBD><EFBFBD>")
|
||||
{
|
||||
string location = "wss://0.0.0.0:8181";
|
||||
_webSocketServer = new WebSocketServer();
|
||||
_webSocketServer.Start(location);
|
||||
button1.Text = "<22>ر<EFBFBD>WebSocket";
|
||||
|
||||
timer1.Interval = 2000;
|
||||
timer1.Start();
|
||||
}
|
||||
else
|
||||
{
|
||||
button1.Text = "<22><><EFBFBD><EFBFBD>Socket<65><74><EFBFBD><EFBFBD>";
|
||||
_webSocketServer.Stop();
|
||||
timer1.Stop();
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private async void timer1_Tick(object sender, EventArgs e)
|
||||
{
|
||||
await Task.Run(() =>
|
||||
{
|
||||
this.Invoke(new Action(() =>
|
||||
{
|
||||
label5.Text = WebSocketServer._classInfos.Count.ToString();
|
||||
label6.Text =WebSocketServer.IWebSocketUserinfo.Count.ToString();
|
||||
label7.Text = WebSocketServer.IWebSocketUserinfo.Where(c=>c.UserType == 1 ).ToList().Count().ToString();
|
||||
label8.Text = WebSocketServer.IWebSocketUserinfo.Where(c => c.UserType == 0).ToList().Count().ToString();
|
||||
}));
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user