Jump to content

  • Log In with Google      Sign In   
  • Create Account


Is C++ better than C for winsock programming?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 nPawn   Members   -  Reputation: 110

Like
Likes
Like

Posted 27 January 2000 - 06:01 AM

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?

Sponsor:

#2 SiCrane   Moderators   -  Reputation: 9492

Like
Likes
Like

Posted 28 January 2000 - 04:25 AM

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.

#3 Geradian   Members   -  Reputation: 122

Like
Likes
Like

Posted 30 January 2000 - 12:42 AM

Check out the Windows version of mAngband. It is open source, and uses UDP.

#4 Dak Lozar   Members   -  Reputation: 122

Like
Likes
Like

Posted 31 January 2000 - 03:24 PM

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.





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS