Jump to content

  • Log In with Google      Sign In   
  • Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

Mussi

Member Since 12 Oct 2004
Offline Last Active Yesterday, 09:23 PM
*****

Topics I've Started

IOTD not as popular?

04 December 2012 - 10:58 PM

Hey guys and galls,

Is it just me or is the IOTD section less commented on since the big site revamp? It feels like there used to be a lot more participants in the comment sections. Any of you feel the same? If this is actually the case, what happened?

Also, the IOTD is not accessible from the menu :(

Connection layer design

28 August 2012 - 06:20 AM

Hey everyone,

I'm looking at some old networking code that I wrote some time ago and I'm looking for a way to improve it and change the design. I enjoy doing this, so that's my motive.

This is all written in C++ and on top of BSD sockets and the goal was to create a connection layer on top of UDP. I'll first show how I achieved this goal previously and point out what I don't like about it and then continue with the ideas that have been running through my mind but seem to fall short.

So currently I have a socket class that's very similar to the one used in Glenn Fielder's Networking for Game Programmers articles, which is basically a class wrapped around the BSD functions.
Managing which packets should go where is done by a class called Tranceiver(<insert oh god why meme>). This class owns a Socket object used to send and receive packets. Connections can be registered here to listen for a specific or any address, once a connection has been setup the Transceiver class passes the packets on to the corresponding connection.
The connection class is responsible for setting up connections, keeping them alive with keep alive packets, detecting disconnects and passing on the packet data(packet minus the header) to some handler and forms the gateway between the two ends to send data across. This class holds a reference to the Tranceiver it's associated with and next to sending packets, it's used to register/de-register on connects/disconnects.

It's that last part that I dislike the most. I don't like de dependency of the two classes on each other and it should be possible to set up a connection with just a socket, since a client that's only connected to a server shouldn't need a manager.

The solution seems simple, have the connection class hold a reference to a socket instead, but now not only do you need to make sure the connection you're registering to a manager uses the same socket but you'll have to manually register/de-register connections.
Another option is to have the connection manager create connections with the appropriate socket and not allow external connections to be registered. Still have to manually register/de-register connections and re-registering becomes confusing, do I destroy and recreate a connection? Calling a method to re-register a connection, accepting a connection as an argument seems weird since only connections created by the manager should be accepted.

What design can I use to make it more consistent, have less dependency and avoid manual registration? Any help or feedback is welcome.

IOTD comment bug?

21 July 2012 - 06:39 AM

Hi,

Got this error message while commenting on this IOTD:
[source lang="bash"]Warning: Data missing in classes_like_composite::add in /var/www/gamedev/admin/sources/classes/like/composite.php on line 477Warning: Relationship ID missing in classes_like_registry::getKey in /var/www/gamedev/admin/sources/classes/like/composite.php on line 143[/source]
Before I started commenting the comment count was 1 but I didn't see an actual comment, after commenting it increased to 2 but neither are visible.

I'm using Firefox 14.0.1 if that's of any help.

PARTNERS