I have set up a server, and the client can connect via UDP on this server machine. However, when I use local network penetration, the UDP server cannot establish a connection. So, I wrote a piece of Node.js code to listen for UDP requests on some local ports, and indeed, I am able to capture these UDP requests. Therefore, my speculation is as follows:
Server -> UDP server port -> Client -> Local port -> Request connection
I am not sure how to resolve this issue, but I can provide my source code for reference: const dgram = require('dgram');
I have set up a server, and the client can connect via UDP on this server machine. However, when I use local network penetration, the UDP server cannot establish a connection. So, I wrote a piece of Node.js code to listen for UDP requests on some local ports, and indeed, I am able to capture these UDP requests. Therefore, my speculation is as follows: Server -> UDP server port -> Client -> Local port -> Request connection
I am not sure how to resolve this issue, but I can provide my source code for reference: const dgram = require('dgram');
// 本地监听的UDP端口 const proxyPort = 25577;
// 目标地址和端口 const targetHost = '139.155.138.49'; const targetPort = 2333;
// 创建UDP服务器 const proxyServer = dgram.createSocket('udp4');
// 监听本地端口 proxyServer.on('listening', () => { const address = proxyServer.address(); console.log(
UDP Proxy Server listening on ${address.address}:${address.port}
); });// 处理收到的UDP消息 proxyServer.on('message', (message, remote) => { console.log(
Received message from ${remote.address}:${remote.port}: ${message}
);});
// 绑定本地代理端口 proxyServer.bind(proxyPort);
I am chinese.