mojira.dev
MCPE-216829

Multipl Local LAN Minecraft Bedrock Servers are not being visualized properly in the Windows Bedrock Client

I have multiple local minecraft bedrock servers on my LAN and the minecraft app will not show more than one LAN server at a time.

Just tested the 1.21.72 version and still having the issue. It looks like the application is only showing the most recently broadcast server detail and I was able to validate the problem with a custom python script that basically send the RAK messages out.

I told the python script to cycle through two different server instances and sure enough the application will only display one at a time. The python script I used for testing is below.

import socket
import struct
import time

UDP_IP = "0.0.0.0"
UDP_PORT = 19132

# List multiple Bedrock servers
servers = [
    {"name": "Survival World", "port": 19132, "guid": 1234567890123456789},
    {"name": "Creative World", "port": 19133, "guid": 9876543210987654321},
]

PROTOCOL_VERSION = "671"
MINECRAFT_VERSION = "1.20.81"
PLAYER_COUNT = "0"
MAX_PLAYERS = "10"
RAKNET_MAGIC = bytes.fromhex("00ffff00fefefefefdfdfdfd12345678")

sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.bind((UDP_IP, UDP_PORT))
sock.settimeout(1)

print("Listening for Bedrock LAN pings on port 19132...")

current_server_index = 0
last_switch_time = time.time()

while True:
    try:
        data, addr = sock.recvfrom(2048)

        if data[0] == 0x01 and len(data) >= 9:
            ping_time = data[1:9]
            server = servers[current_server_index]

            server_info = (
                f"MCPE;{server['name']};{PROTOCOL_VERSION};{MINECRAFT_VERSION};"
                f"{PLAYER_COUNT};{MAX_PLAYERS};{server['guid']};Bedrock level;Survival;1;{server['port']};{server['port']};"
            )
            server_info_bytes = server_info.encode("utf-8")

            response = (
                b'\x1c' +
                ping_time +
                struct.pack('>Q', server['guid']) +
                RAKNET_MAGIC +
                struct.pack('>H', len(server_info_bytes)) +
                server_info_bytes
            )

            sock.sendto(response, addr)
            print(f"Responded to ping from {addr} for server '{server['name']}'")

    except socket.timeout:
        pass

    if time.time() - last_switch_time >= 10:
        current_server_index = (current_server_index + 1) % len(servers)
        last_switch_time = time.time()

Linked issues

Attachments

Comments 1

This issue is being tracked at MCPE-190764.

Sean Kennedy

(Unassigned)

Unconfirmed

Windows

Windows 11

1.21.72 Hotfix

Retrieved