bedrock-protocol icon indicating copy to clipboard operation
bedrock-protocol copied to clipboard

Is there a way to set timeout for ping?

Open MiniPandi opened this issue 7 months ago • 4 comments

I'm trying to ping a mc server like this

const be = require('bedrock-protocol');

be.ping({
host: 'donutsmp.net',// this is for example a server wich takes longer then 1 sec to ping
port: 19032
})

(ignore if i mistyped somting this is just an example on how i do it cuse in my real code i use variables wich have user input) so this is the error i get:

RakTimeout [Error]: Ping timed out
    at /home/minipandi/coding/mcss/node_modules/bedrock-protocol/src/rak.js:75:13
    at waitFor (/home/minipandi/coding/mcss/node_modules/bedrock-protocol/src/datatypes/util.js:30:32)
    at async Object.ping (/home/minipandi/coding/mcss/node_modules/bedrock-protocol/src/createClient.js:95:41)
    at async pingBedrockServer (/home/minipandi/coding/mcss/index.js:193:22)
    at async /home/minipandi/coding/mcss/index.js:155:15

i have looked at the methode in rak.js and it has a ping value wich is defualt 1000ms but idk did not find how to change that?

MiniPandi avatar Apr 12 '25 13:04 MiniPandi