Jump to content

Evayr's Blog

  • entries
    5
  • comments
    13
  • views
    7,008

EvayrNet: Debugging functionality


f13rce

1,796 views

 Share

Hi! It has been a while. Here's an update on my networking library EvayrNet which is available for C++ users of Leadwerks:

 

While implementing it into the test project in Leadwerks, I saw that the use case had some flaws which made it really hard to debug what's going on. I figured that I should be spending some time on fixing some flaws. After a few weeks I came up with the following upgrades:

  1. Debugging class
  2. Simulation mode
  3. More debugging information available

Here's some detailed explanation:

 

Debugging class

I was using a lot of "printf" before which made it hard to:

  • Find out where it's being called
  • Disable whenever I don't need it anymore

This is when I decided to make a debugging class. I replaced the printf with a custom Print function which allows you to do the same as before - except you can disable any kind of printing whenever you want (like during release builds).

 

I also realized that capturing data is a pretty cool feature to have, which makes it easier to visualize the data you want to debug. For that I created a SaveText function which accepts a string and a filename as arguments so you can separate data like "Pings per interval", "Bytes sent per second", etc.

 

Here is an example what you can do with it:

blogentry-358-0-42708300-1490806770_thumb.png

 

Simulation mode

This is an interesting one that I just had to implement. A connection cannot always perfect, and it can be hard to always expect a good outcome (while you might not notice it because of your tests on localhost). This is why I introduced the manipulation of the following networking stats:

  1. Minimum latency (in ms)
  2. Random latency (in ms)
  3. Packet drop percentage
  4. Packet duplication percentage

It's also very easy to activate and deactivate. All you have to do is NetworkManager::StartSimulation(...) and StopSimulation(). Here is it in the command line when you activate it:

blogentry-358-0-27976100-1490807270_thumb.png

 

More debugging information available

At last I added more ways to debug the network statistics to really see what is going on. Are you not receiving data anymore? Are you flooding the network? The following information is now ready to be displayed:

  • Newest ping (either to the server or from a specific client)
  • Average ping (this as well^)
  • Incoming amount of packets per second
  • Outgoing amount of packets per second
  • Packets per second lost
  • Incoming data per second (in bytes)
  • Outgoing data per second (in bytes)
  • Current active connections (primarily for the server)

That's... quite a lot more than before! Previously you could only see if you're connected and if you're the server. I hope this information will make it easier for users to visualize traffic and debug any problems they might be having. And of course, you can mix this up with the debugging class to make cool graphs like above!

 

Final words

I'm still planning on making some extra information, like on specifics to see what kind of message is creating the amount of bytes send/received. This should help debugging even more. Other than that there are still some enhancements I'd like to put in such as encryption. These can be seen here.

 

I hope you liked this blog post! Next time I will probably be showing how to implement EvayrNet into your C++ Leadwerks project, so you can toy around with it. wink.png

  • Upvote 11
 Share

0 Comments


Recommended Comments

There are no comments to display.

Guest
Add a comment...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...