<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>Networking libraries?</title>
		<link>http://www.allegro.cc/forums/view/618093</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Sat, 25 Apr 2020 21:39:29 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Hey all, I&#39;m looking to beef up my networking features for gaming or otherwise as it&#39;s becoming more clear to me that having networking/multiplayer in apps is a bit more critical these days.  I&#39;d like to use a library and am looking for suggestions.</p><p>I&#39;m not very familiar with the topologies for how networking programs work (server?, host?, client? host always running maintains a client list? two nodes connect directly 1:1? wake on lan?)</p><p>There are two libraries that I&#39;m aware of: Boost ASIO, and <a href="http://enet.bespin.org/Installation.html">enet</a>.  I feel like Enet is the professional solution, but I&#39;m a bit turned off by the requirements for build (windows requires downloading a dll, etc).  I&#39;d like for this to be easily buildable.</p><p>In the past (2015 wow that was a long time ago), I used <a href="https://github.com/MarkOates/flare_network">Boost ASIO for a project called &quot;flare_network&quot;</a> as part of exploration.  I&#39;ll need to look back into that and see if it&#39;s still feasible.  Taking the Boost route sounds very manual (which is fine, but it would be nice to see this feature out sooner than later), and also the common concern of Boost as a dependency is not good.  (But, I&#39;m just reading now, it looks like <a href="https://think-async.com/Asio/AsioStandalone.html">most of ASIO is part of std since C++11</a>).</p><p>Regardless, doing ASIO manually with no experience I feel like I&#39;m just opening up a can of worms for edge cases that I have no idea could even exist.  Or not, maybe it&#39;s not that hard.</p><p>Any of you guys have experience or recommendations on what routes to take?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Mark Oates)</author>
		<pubDate>Thu, 16 Apr 2020 23:10:49 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>depends on your needs, and your tolerance to latency.</p><p>anything TCP is simplest to deal with but it&#39;s much slower due to acks.</p><p>pure UDP is fast but unreliable, so most solutions involve some hybrid of the two.</p><p>ENet or RakNet work just fine for many general applications - the question becomes, if a client loses connection due to wifi/unstable connection, how do you resync them? If it&#39;s a shooter, you need a way to know who was right (latency compensation), so it quickly becomes a complex problem. In fact, a simple web socket library can probably handle a lot of use cases, it&#39;s more about how you deal with sessions, latency, etc that&#39;s application specific and can be challenging.</p><p>Some games go as far as to have the server replay the simulation to know the ground truth of what really happened.</p><p>The most basic form of a game server is just message passing really.</p><p>My game Stemwater Spades features a fully implemented lobby, client server model, and authentication with a central login server, and it never trusts the client. It has its own message system. You can use something like protobuff but I enjoyed doing it myself  It might be helpful: <br /><a href="https://github.com/jmasterx/StemwaterSpades/blob/master/Spades%20Game/Game/Net/ServerCore.cpp">https://github.com/jmasterx/StemwaterSpades/blob/master/Spades%20Game/Game/Net/ServerCore.cpp</a></p><p>you can branch around from there, there&#39;s a lot of files.</p><p>If you have questions about the code, I might remember how it works but it&#39;s been a while <img src="http://www.allegro.cc/forums/smileys/wink.gif" alt=";)" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (jmasterx)</author>
		<pubDate>Fri, 17 Apr 2020 02:20:57 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>If you&#39;re satisfied with TCP wrappers you can try Gully&#39;s code from his networking library Nilorea (<a href="https://www.allegro.cc/forums/thread/618081">https://www.allegro.cc/forums/thread/618081</a> ). I&#39;m using it currently, and I made some nice C++ wrappers around a basic Client / Server / Network class.</p><p>Also, building enet static is easy. It&#39;s a one line addition to their CMake file. I changed that a long time ago. <img src="http://www.allegro.cc/forums/smileys/cool.gif" alt="8-)" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Fri, 17 Apr 2020 06:22:24 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title"><a href="http://www.allegro.cc/forums/thread/618093/1045642#target">Edgar Reynaldo</a> said:</div><div class="quote"><p> It&#39;s a one line addition to their CMake file. I changed that a long time ago. <img src="http://www.allegro.cc/forums/smileys/cool.gif" alt="8-)" /></p></div></div><p>Nice. Did you get a commit on ENet? <img src="http://www.allegro.cc/forums/smileys/cheesy.gif" alt=":D" /></p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p> If you&#39;re satisfied with TCP wrappers</p></div></div><p>To be completely honest, I&#39;m still not 100% on TCP, HTTP, and TLS (are there any others?).</p><p>My thought, was that TCP was the fire-it-and-forget-it message type.  That&#39;s the one I&#39;m going for.  I can figure out alternative ways to make those data packets sync and communicate, so I don&#39;t want to get more complicated than that.</p><div class="quote_container"><div class="title"><a href="http://www.allegro.cc/forums/thread/618093/1045640#target">jmasterx</a> said:</div><div class="quote"><p> anything TCP is simplest to deal with but it&#39;s much slower due to acks.</p></div></div><p>Interesting. I always thought TCP (was|would be) the fastest.  I tried it over an ngrok connection.  It&#39;s a lot slower than I expected.  localhost speeds is basically what I&#39;m looking for.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p> The most basic form of a game server is just message passing really.</p></div></div><p>Ok. That sounds good.</p><p>Alright, I have a really cool breakthrough for sure.  I managed to pull my old <a href="https://github.com/MarkOates/flare_network">https://github.com/MarkOates/flare_network</a> project and built without error right out of the box on my Mac.</p><p>I converted the project and removed the boost dependency.  Now, the dependency is only a cloned repo of asio.  It builds on Windows now, too (but I have a problem with the client executing, keep getting a &quot;Exception: resolve: No such host is known.&quot; on win when not using localhost).  So major progress.  Definitely usable primitives to do what I plan to do.</p><p>It&#39;s basically a silent server program (shows connect and disconnect messages when running) that relays basic messages, and a client program that you type into std::in and after pressing ENTER, will send the message to the server. The client also receives and outputs all messages relayed from the server.</p><p>I&#39;ve tried it on localhost (works on Mac and Win), and tried it connecting over a ngrok tcp tunnel (works on Mac). I had my laptop sending messages to my MacMini and vice versa. Next steps would be to componentize the class, and extract it from the entry point main, and add tests.</p><p>Legit though, I&#39;m drinking a glass of wine to this. I consider this a huge success.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Mark Oates)</author>
		<pubDate>Fri, 17 Apr 2020 07:30:29 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title"><a href="http://www.allegro.cc/forums/thread/618093/1045643#target">Mark Oates</a> said:</div><div class="quote"><p> localhost speeds is basically what I&#39;m looking for.</p></div></div><p>Over the internet ? I don&#39;t think so hahah...
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (jmasterx)</author>
		<pubDate>Fri, 17 Apr 2020 21:49:53 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>HTTP/HTTPS and TLS are protocols over TCP IP.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (GullRaDriel)</author>
		<pubDate>Sun, 19 Apr 2020 00:01:25 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Oh!, do try LibPoco. I know you use C++ so you will be right at home. They are open source and feature some really neat extras. The website is right <a href="https://pocoproject.org/">here.</a></p><p>POCO is very network focused. And their aim is to provide easy network capabilities to C++ programs. You have raw UDP and TCP ports, HTTP servers, Database connections, and many other things.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Rodolfo Lam)</author>
		<pubDate>Wed, 22 Apr 2020 06:59:49 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Okay Mark:</p><p>TCP-IP is the transport protocol. Anything else on top of it is using basic connect/accept send/recv. </p><p>HTTPS/SSL are encrypted protocols over tcp ip. What I stated before is true.</p><p>For your needs you&#39;d better stick to enet/known equivalent or even parts of my lib. You can cannibalize it to just use what you need. </p><p>Let&#39;s warn you: cross platform networking and encapsulation are pains. When you&#39;ll be there we will talk about dead reckoning algorithms and such.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (GullRaDriel)</author>
		<pubDate>Sat, 25 Apr 2020 21:39:29 +0000</pubDate>
	</item>
</rss>
