Advertisement

Templates & Inheritance

Started by November 08, 2000 08:52 PM
9 comments, last by Shannon Barber 24 years, 2 months ago
I just want to make sure you have considered this. If you have and didn''t like it, or are already doing it, or any other reason you feel like it just ignore it. Do it like a message loop. Have the server call a function in each packet handler asking it if it knows what to do with this packet. When one indicates it does give it to that packet handler to process. That reduces the code for the packet handler to just what is needed to recognize it''s own packet format and process that packet. If you later need to pass a new structure you just create a packet handler with the new code and add it to the server''s list of packet handlers. The idea being that across a single connection you need to pass many differant types of data. Not all that much differant than having a single packet handler check for one of 40 data types and calling the appropriate routine, but it makes it a little easier to maintain since you can focus on just the processing for that one type of data in a single class.
Keys to success: Ability, ambition and opportunity.

This topic is closed to new replies.

Advertisement