<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="http://test.amule.szerverem.hu/w/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://test.amule.szerverem.hu/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=84.50.25.154</id>
		<title>AMule Project FAQ - User contributions [en]</title>
		<link rel="self" type="application/atom+xml" href="http://test.amule.szerverem.hu/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=84.50.25.154"/>
		<link rel="alternate" type="text/html" href="http://test.amule.szerverem.hu/wiki/Special:Contributions/84.50.25.154"/>
		<updated>2026-04-05T14:07:12Z</updated>
		<subtitle>User contributions</subtitle>
		<generator>MediaWiki 1.23.3</generator>

	<entry>
		<id>http://test.amule.szerverem.hu/wiki/Nodes.dat_file</id>
		<title>Nodes.dat file</title>
		<link rel="alternate" type="text/html" href="http://test.amule.szerverem.hu/wiki/Nodes.dat_file"/>
				<updated>2006-06-20T13:21:47Z</updated>
		
		<summary type="html">&lt;p&gt;84.50.25.154: Added Python script for dumping nodes.dat&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;center&amp;gt;&lt;br /&gt;
'''English''' | [[Nodes.dat_file-de|Deutsch]]&lt;br /&gt;
&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== File ==&lt;br /&gt;
&lt;br /&gt;
'''Name:''' ''nodes.dat''&lt;br /&gt;
&lt;br /&gt;
'''Location:''' ''~/.aMule/''&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
This file stores details about other known [[Kademlia]] [[client]]s (also known as [[node]]s).&lt;br /&gt;
&lt;br /&gt;
It is usually used to achieve a successfull [[bootstrap]] faster.&lt;br /&gt;
&lt;br /&gt;
== Format ==&lt;br /&gt;
&lt;br /&gt;
As you can see, all the fields are stored without any separator character. This is done like this because all the fields have a specific size:&lt;br /&gt;
*''Number of contacts'': Number of contacts that will be listed (4 bytes)&lt;br /&gt;
&lt;br /&gt;
After specifying the number of contacts that will be listed, the file lists them. Each contact takes 25 bytes, splitted into the following fields:&lt;br /&gt;
*''ClientID'': The contact's [[ID|ClientID]] (16 bytes)&lt;br /&gt;
*''IP'': The contact's [[IP]] (4 bytes)&lt;br /&gt;
*''UDP Port'': The [http://www.ietf.org/rfc/rfc768.txt UDP] [[port]] to [[connect]] to when trying to reach the contact (2 bytes)&lt;br /&gt;
*''TCP Port'': The [http://www.ietf.org/rfc/rfc793.txt TCP] [[port]] to [[connect]] to when trying to reach the contact (2 bytes)&lt;br /&gt;
*''Type'': This indicates the [[type]] of the contact, which is how much you can be confident on that contact (a scale from ''0'' to ''4'', being ''0'' the best and ''4'' the worst). (1 byte)&lt;br /&gt;
&lt;br /&gt;
Once this data is put together, it is stored in little-endian.&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&lt;br /&gt;
The following is a hex dump of an hypothetic ''preferences.dat'' file:&lt;br /&gt;
&lt;br /&gt;
''0200000012257425DBA4EDDBD097150757404486E55E04DE40123612021F64632587A31EC2FC8566C4A9BAB184E6E9B7D44012361202''&lt;br /&gt;
&lt;br /&gt;
In the above example, the following data can be seen:&lt;br /&gt;
&lt;br /&gt;
*Number of contacts: ''2'' (In hex: ''02000000'', remember it's in [[little endian]])&lt;br /&gt;
*Contact #1:&lt;br /&gt;
**ClientID: ''12257425DBA4EDDBD097150757404486''&lt;br /&gt;
**IP: ''222.4.94.229'' (In hex: ''E55E04DE'', remember it's in [[little endian]])&lt;br /&gt;
**[http://www.ietf.org/rfc/rfc768.txt UDP] Port: ''1240'' (In hex: ''4012'', remember it's in [[little endian]])&lt;br /&gt;
**[http://www.ietf.org/rfc/rfc793.txt TCP] Port: ''1236'' (In hex: ''3612'', remember it's in [[little endian]])&lt;br /&gt;
**Type: ''2'' (In hex: ''02'')&lt;br /&gt;
*Contact #2:&lt;br /&gt;
**ClientID: ''1F64632587A31EC2FC8566C4A9BAB184''&lt;br /&gt;
**IP: ''212.183.233.230'' (In hex: ''E6E9B7D4'', remember it's in [[little endian]])&lt;br /&gt;
**[http://www.ietf.org/rfc/rfc768.txt UDP] Port: ''1240'' (In hex: ''4012'', remember it's in [[little endian]])&lt;br /&gt;
**[http://www.ietf.org/rfc/rfc793.txt TCP] Port: ''1236'' (In hex: ''3612'', remember it's in [[little endian]])&lt;br /&gt;
**Type: ''2'' (In hex: ''02'')&lt;br /&gt;
&lt;br /&gt;
== Extra ==&lt;br /&gt;
&lt;br /&gt;
Since the ''number of contacts'' field is 4 bytes long, the maximum number of [[node]]s you could store in this file is 4294967296 (~4300M), which should be far enough. Anyway, since this number is so big, [[aMule]], [[eMule]] and all clients have hard limitted the amount of contacts that can be stored ([[aMule]]'s hard limit is ''5000'').&lt;br /&gt;
&lt;br /&gt;
Since ''Type 4'' contacts are those which are marked for deletion, there should never be any ''Type 4'' contact in the ''nodes.dat'' file. If there was, it would just be ignored when reading the file.&lt;br /&gt;
&lt;br /&gt;
== Script for dumping nodes.dat ==&lt;br /&gt;
&lt;br /&gt;
Here's a little script I wrote for dumping contents of the nodes.dat file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env python&lt;br /&gt;
# this code belongs to public domain&lt;br /&gt;
&lt;br /&gt;
import struct&lt;br /&gt;
nodefile = open('nodes.dat', 'r')&lt;br /&gt;
(count,) = struct.unpack(&amp;quot;&amp;lt;I&amp;quot;, nodefile.read(4))&lt;br /&gt;
&lt;br /&gt;
print ' idx type    ip address    udp   tcp'&lt;br /&gt;
for i in xrange(count):&lt;br /&gt;
  (clientid, ip1, ip2, ip3, ip4, udpport, tcpport, type) = \&lt;br /&gt;
      struct.unpack(&amp;quot;&amp;lt;16s4BHHB&amp;quot;, nodefile.read(25))&lt;br /&gt;
  ipaddr = '%d.%d.%d.%d' % (ip1, ip2, ip3, ip4)&lt;br /&gt;
  print '%4d %4d %-15s %5d %5d' % (i, type, ipaddr, udpport, tcpport)&lt;br /&gt;
nodefile.close()&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>84.50.25.154</name></author>	</entry>

	</feed>