Glitch TCP and UDP server

I am trying to create a TCP or UDP server for my game. I created but when i use TelNet client or online TCP client to connect to my server, it responds 400 Bad Request error. How can ı solve this?

My code:

var net = require('net');

const server_config = {
  host: '127.0.0.1',
  port: process.env.PORT
};

var server = net.createServer(function(socket) {
	socket.write('Echo server\r\n');
	socket.pipe(socket);
});

server.listen(server_config.port, server_config.port)

console.log(`Sunucu ${server_config.port} portunda çalışıyor!`);

Hey @kenux I don’t think you’re going to have much luck here with the most straightforward configuration - Glitch’s proxy will only forward requests on web-like ports to the project container, so requests trying to communicate with your glitch.me address on a non-web port won’t be forwarded to your project at all (that is to say, trying to communicate over myproject.glitch.me:3000 won’t work as it might if the application was running in its own VM).

You might be able to use something like what @etamponi was talking about in What's the port range users have at Glitch? to work around this issue.

Hope this helps!

1 Like