<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Johannes &#34;jfk&#34; Kuhlmann&#039;s Blog &#187; master server</title>
	<atom:link href="http://johanneskuhlmann.de/blog/tag/master-server/feed/" rel="self" type="application/rss+xml" />
	<link>http://johanneskuhlmann.de/blog</link>
	<description></description>
	<lastBuildDate>Fri, 11 Jun 2010 10:27:17 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Pitfalls Of RakNet&#8217;s Lightweight Database</title>
		<link>http://johanneskuhlmann.de/blog/2008/06/11/pitfalls-of-raknets-lightweight-database/</link>
		<comments>http://johanneskuhlmann.de/blog/2008/06/11/pitfalls-of-raknets-lightweight-database/#comments</comments>
		<pubDate>Wed, 11 Jun 2008 12:26:23 +0000</pubDate>
		<dc:creator>jfk</dc:creator>
				<category><![CDATA[kos]]></category>
		<category><![CDATA[lightweight database]]></category>
		<category><![CDATA[master server]]></category>
		<category><![CDATA[raknet]]></category>
		<category><![CDATA[server list]]></category>

		<guid isPermaLink="false">http://johanneskuhlmann.de/blog/?p=23</guid>
		<description><![CDATA[As described yesterday, I&#8217;ve used RakNet&#8217;s Lightweight Database to keep a server list on a master server. Overall it isn&#8217;t that difficult, but there were a few things I had problems with. I think that it&#8217;s mainly due to the poor documentation of the Lightweight Database plugin. The documentation can be found here (manual), here [...]]]></description>
			<content:encoded><![CDATA[<p>As described yesterday, I&#8217;ve used RakNet&#8217;s <b>Lightweight Database</b> to keep a server list on a master server. Overall it isn&#8217;t that difficult, but there were a few things I had problems with. I think that it&#8217;s mainly due to the poor documentation of the Lightweight Database plugin. The documentation can be found <a href="http://www.jenkinssoftware.com/raknet/manual/lightweightdatabase.html">here (manual)</a>, <a href="http://www.jenkinssoftware.com/raknet/manual/Doxygen/html/classLightweightDatabaseServer.html">here (Doxygen for the server)</a> and <a href="http://www.jenkinssoftware.com/raknet/manual/Doxygen/html/classLightweightDatabaseClient.html">here (Doxygen for the client)</a>.</p>
<p><b>Column Numbers</b></p>
<p>My first problem was finding the proper cells in the table on the client. I connected to the server and got an object of type <code>DataStructures::Table</code> (<a href="http://www.jenkinssoftware.com/raknet/manual/Doxygen/html/classDataStructures_1_1Table.html">documentation here</a>) through deserializing the incoming stream. But when I then tried to use the member function <code>GetCellValueByIndex</code> of the Table class I got mostly garbage or data that didn&#8217;t make any sense. I then got the idea to simply dump the whole table to the console and was able to see that the table had more columns than I had specified when creating the table.</p>
<p>The <code>LightweightDatabaseServer::AddTable</code> member function silently adds columns to the table which it needs to work. I understand that those columns are necessary, but the function&#8217;s documentation should mention this because when you otherwise get strange results when using <code>GetCellValueByIndex</code> with an index you think is right though it&#8217;s not right.</p>
<p>Additionally, the number of columns added depends on the parameters given to <code>AddTable</code>. So you should make your choice about the parameters you want to hand <code>AddTable</code> and then check what columns the table really contains.</p>
<p><b>Pings</b></p>
<p>RakNet offers the possibility to <i>ping</i> a remote host, but RakNet doesn&#8217;t do normal pings, just its own pings which need a RakNet peer on the other side. I stumbled across this when I tried to use the <code>removeRowOnPingFailure</code> option of <code>LightweightDatabaseServer::AddTable</code>. After adding my server to the table I closed the connection to the server and destroyed the instance of <code>RakPeerInterface</code>.</p>
<p>If <code>removeRowOnPingFailure</code> was set at the master server the newly added server would only show up for a few seconds or minutes and vanish again. As it turns out RakNet pings the other side by trying to connect to the port the lightweight database request came from. Because I had already destroyed the peer which had used that port, the ping failed and my server was removed from the list.</p>
<p>I fixed this problem by making the local peer, that connected to the master server, use the port number that would later be used to accept connections from player clients. This actually worked and I&#8217;ve learned that, although RakNet doesn&#8217;t need to have the connection kept open, it needs to find a RakNet peer on the exact same port that was used to connect to the server when adding something to the table. </p>
]]></content:encoded>
			<wfw:commentRss>http://johanneskuhlmann.de/blog/2008/06/11/pitfalls-of-raknets-lightweight-database/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
