Talk:Nodes.dat file

From AMule Project FAQ
Jump to: navigation, search

I have just started aMule and there is an error message at the bottom: CFile: Error when opening file (/home/myuser/aMule/nodes.dat): No such file

How do I create this file?


I wrote this Perl version of the unpacker for shits and giggles...

# this code belongs to public domain

use strict;
use warnings;

open (NODES, "<nodes.dat");
my $count;
read (NODES, $count, 4) or die ("Can't read nodes.dat: $!");
$count = unpack ('V', $count);
print " idx type    ip address    udp   tcp\n";
for(1..$count) {
  my $data;
  my $read = read (NODES, $data, 25);
  if ($read==0) {
    die ("Counted $count entries but read only $_!");
  } elsif ($read<25) {
    die ("Short read for entry $_ (counted $count entries)!");
  my ($clientid, $ip1, $ip2, $ip3, $ip4, $udpport, $tcpport, $type) = unpack ('a16CCCCvvC', $data);
  my $ipaddr = sprintf("%d.%d.%d.%d", $ip1, $ip2, $ip3, $ip4);
  printf ("%4d %4d %-15s %5d %5d\n", $_, $type, $ipaddr, $udpport, $tcpport);

-- 05:55, 24 March 2008 (CET)