gamedig / node-gamedig

Query game servers and not only! Node.JS/Deno/Bun or Bash (via the CLI).
https://www.npmjs.com/package/gamedig
MIT License
606 stars 146 forks source link

UDP Watchdog Timeout with DayZ servers #8

Closed overra closed 10 years ago

overra commented 10 years ago

I've tried querying both DayZ standalone and mod servers but I keep getting the UDP Watchdog Timeout error.

Here's the code:

var Gamedig = require('gamedig');
Gamedig.debug = true;
Gamedig.query({type: 'dayz', host: '199.189.85.77'}, function () { console.log(arguments) })

And the output:

$ node index.js                                                        
199.189.85.77:2302 UDP--> ffffffff54536f7572636520456e67696e6520517565727900
{ '0': 
   { error: 'UDP Watchdog Timeout',
     query: 
      { host: '199.189.85.77',
        address: '199.189.85.77',
        port: 2302,
        port_query: 2302,
        type: 'dayz',
        pretty: 'DayZ' } } }
mmorrisontx commented 10 years ago

It seems that dayz uses a query port that is different from its game port, and it can't easily be calculated on the fly. I've found that often, the query port is the game port PLUS 24714 or 24715 (meaning that it will be 27016 or 27017 when using the default 2302 game port).

You can pass in this query port with the port_query request parameter.

I've just pushed an update that will attempt 27016 for dayz by default.