for a game? It seems that using inheritance and maybe templates would be a great way to make a generic networking system, yet all the examples i see for writing winsock programs are in C++. Does anyone know where some good examples of a basic C++ network engines are, or perhaps have some tips on the best way to design a basic network object? Or is it best to stick with straight C for network programming?
One reason that you may only see C code examples for winsock, is that the winsock API is already fairly object oriented. To create a socket you call a constructor specifying it''s protocol, and boom you get a handle to a socket and you start calling functions on it. The functions you call are the same no matter what protocol you specified. That being said, it might be easier if you encapsulated the functions yourself in C++, but it would basically only aid your understanding of the code. I personally use C style socket calls exclusively.
I would suggest writting your own class to wrap up the winsock code. This allows two things. One: You encapsulate the down-and-dirty code. Two: You can reuse the objects. I have a set of classes that I have used for the past couple projects, they are much more robust and have less overhead (read smaller feature-set) than the CSocket class offered in MFC. If you want I can send you the source and some examples of how to use them.