C#客户端SocketIoClientDotNet。客户端不工作(节点服务器)
C#winfrom客户端C#客户端SocketIoClientDotNet。客户端不工作(节点服务器),c#,node.js,socket.io,C#,Node.js,Socket.io,C#winfrom客户端 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 Quobject.SocketIo
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 Quobject.SocketIoClientDotNet.Client;
namespace socket_TEST
{
#nullable enable
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
connect();
}
public void connect()
{
var socket = IO.Socket("http://127.0.0.1:3000/");
socket.On(Socket.EVENT_CONNECT, () =>
{
MessageBox.Show("connection!");
});
socket.On("connection", () =>
{
MessageBox.Show("connection!");
});
}
}
}
#nodejs服务器
const app=require('express')();
const server=require('http').Server(app);
const io=require('socket.io')(server);
io.sockets.on("connection",function(socket){
console.log("new client");
});
server.listen(3000,function(){
console.log("------SERVER RUNNING------");
});
我是一个英语不好的学生
因此,我请求您理解如何使用翻译
我想连接C#和nodejs服务器
但是连接仍然不起作用。你能告诉我为什么吗
我该如何解决这个问题呢?我看到SocketIoclientNet这个项目已经被弃用了