I am learning about the Minecraft Server Protocol and attempting to implement the initial handshake to get server information. The wiki says that the client will send an initial request with some data about the server protocol version, server address, etc. and then it will send another packet which should then let the server know to send a response back. I’m currently just trying to ensure that I get both requests using the following
Bun.listen({
hostname: "localhost",
port: 25565,
socket: {
data(socket, data) {
console.log(data);
},
open(socket) {
console.log("Socket opened");
},
close(socket) {
console.log("Socket closed");
},
drain(socket) {},
error(socket, error) {
console.error("Socket error:", error);
},
},
});
My issue is that I am only getting the initial response. I know what I need to do to parse the response, but why am I not getting the second request? I see the following logged when I add the server via Minecraft
Socket opened
Buffer(19) [ 16, 0, 249, 5, 9, 108, 111, 99, 97, 108, 104, 111, 115, 116, 99, 221, 1, 1, 0 ]