Skocz do zawartości

gromek97

Użytkownicy
  • Zawartość

    5
  • Rejestracja

  • Ostatnio

Reputacja

0 Normalna

O gromek97

  • Ranga
    Nowy użytkownik
  1. JavaScript/Node.JS

    A jeszcze takie pytanie jak zrobić to w drugą stronę?
  2. JavaScript/Node.JS

    dziękuję bardzo dużo mi pomogliście
  3. JavaScript/Node.JS

    Zrobiłem coś takiego tylko dostaje zero odpowiedzi const net = require('net'); const client = net.connect({host: '81.2.247.112', port: 8124}, () => { // 'connect' listener console.log('connected to server!'); client.write('\x7f\x00\x00\x01\xf1\x00\x04\xff'); }); client.on('data', (data) => { console.log(data); client.end(); }); client.on('end', () => { console.log('disconnected from server'); });
  4. JavaScript/Node.JS

    Chciałbym wiedzieć jak to dokładnie działa
  5. Cześć, czy pomoże mi ktoś przerobić ten kod z php na javascript? <?php /* shard_status.php v1.0 This is an example of how to get the status of a UO emulator (RunUO, ServUO, Sphere, etc.) by sending a packet to the shard address:port. \x7f\x00\x00\x01\xf1\x00\x04\xff Newer ServUO Shards will return something like this: Array ( [0] => ServUO [1] => Name=My Shard [2] => Age=3 [3] => Clients=1 [4] => Items=112187 [5] => Chars=2934 [6] => Mem=217514K [7] => Ver=2 ) RunUO and Sphere Shards don't return version: Array ( [0] => ServUO [1] => Name=My Shard [2] => Age=3 [3] => Clients=1 [4] => Items=112187 [5] => Chars=2934 [6] => Mem=217514K ) 2016 - Ixtabay for www.RunUO.com */ $shard_addr ="login.uodemise.com"; $shard_port ="2593"; $fp = fsockopen($shard_addr, $shard_port); if (!$fp) { echo "Cannot connect to $shard_addr:$shard_port\n"; } else { fwrite($fp, "\x7f\x00\x00\x01\xf1\x00\x04\xff"); stream_set_timeout($fp, 2); $res = fread($fp, 2000); $info = stream_get_meta_data($fp); fclose($fp); if ($info['timed_out']) { echo 'Connection to to $shard_addr:$shard_port timed out!'; } else { $ver = ''; $arr = explode(',', $res); // print_r($arr); // Uncomment if you want to see the raw array $emu = $arr[0]; $name = ltrim(strstr($arr[1],'='), '='); $age = ltrim(strstr($arr[2], '='), '='); $clients = ltrim(strstr($arr[3], '='), '='); $items = ltrim(strstr($arr[4], '='), '='); $mobs = ltrim(strstr($arr[5], '='), '='); $mem = ltrim(strstr($arr[6], '='), '='); if ($emu <> "ServUO") $ver = "Unknown"; // Only ServUO Shards return version else $ver = ltrim(strstr($arr[07], '='), '='); // Example usage echo <<<EOF <style type="text/css"> table tr th, table tr td { border-right: none; border-bottom: none; cell-padding-left: 2px; min-width: 100px; } th { text-align:right; } </style> <table> <tr> <th>Status:</th> <td>Online</td> </tr> <tr> <th>Emu:</th> <td>$emu</td> </tr> <tr> <th>Name:</th> <td>$name</td> </tr> <tr> <th>Uptime:</th> <td>$age hours</td> </tr> <tr> <th>Players Online:</th> <td>$clients</td> </tr> <tr> <th>Total Items:</th> <td>$items</td> </tr> <tr> <th>Mobs:</th> <td>$mobs</td> </tr> <tr> <th>Memory Used:</th> <td>$mem</td> </tr> <tr> <th>Version:</th> <td>$ver</td> </tr> </table> EOF; } } ?>
×