Sandertv / gophertunnel

General purpose library for Minecraft Bedrock Edition software written in Go
MIT License
423 stars 96 forks source link

query.Do against BDS 1.14.30.2 results in read udp i/o timeout #29

Closed itzg closed 4 years ago

itzg commented 4 years ago

I have downloaded a fresh copy of BDS and started it with no modification of properties. When using query.Do with an argument of "127.0.0.1:19132" I get the following error:

read udp 127.0.0.1:34972->127.0.0.1:19132: i/o timeout

The code I used for testing is https://gist.github.com/itzg/899dd84d2cea8810f2ec1d747dc46762#file-main-go

and the BDS server shows the following:

$ LD_LIBRARY_PATH=. ./bedrock_server 
NO LOG FILE! - setting up server logging...
[2020-03-01 16:47:15 INFO] Starting Server
[2020-03-01 16:47:15 INFO] Version 1.14.30.2
[2020-03-01 16:47:15 INFO] Session ID fc8d2f1e-9cc1-4e58-900e-90320c26c974
[2020-03-01 16:47:15 INFO] Level Name: Bedrock level
[2020-03-01 16:47:15 INFO] Game mode: 0 Survival
[2020-03-01 16:47:15 INFO] Difficulty: 1 EASY
[2020-03-01 16:47:18 INFO] IPv4 supported, port: 19132
[2020-03-01 16:47:18 INFO] IPv6 supported, port: 19133
[2020-03-01 16:47:18 INFO] IPv4 supported, port: 46664
[2020-03-01 16:47:18 INFO] IPv6 supported, port: 42648
[2020-03-01 16:47:19 INFO] Server started.

Do I need to adjust something in server.properties to enable query support? BTW, when I try the other mystery port (46664 in this particular case), I get the same error. I am running both on Ubuntu 18.04.4 LTS and a Windows 10 client is able to discover and connect fine to the server.

Sandertv commented 4 years ago

Unfortunately the Bedrock Dedicated Server doesn't have the query protocol built-in. Some information may be obtained by using the raknet package (https://github.com/Sandertv/go-raknet), using raknet.Ping(), such as the amount of players online. The query package can only be used for some server softwares like PocketMine or Minecraft Java softwares which do have this implemented.

itzg commented 4 years ago

Thanks for the super fast response and I'll give your raknet module a try.

FYI, this was the wording in the package docs that threw me off:

Package query specialises on Minecraft Bedrock Edition related queries

Sandertv commented 4 years ago

I'll change that, thank you!

itzg commented 4 years ago

raknet.Ping worked perfectly btw.