views:

251

answers:

3

I recently finished this book on Managed C++, and found it very interesting... But I realize the topic is woefully out-of-date now, with the advent of C++/CLI.

So I'm looking for recommendations on a new book to read, something to update my knowledge of C++ and .NET. I'm especially interested in writing server applications (using sockets and TCP).

+3  A: 

Probably not. You will find books on Berkely Sockets using C, .NET Sockets using C# or VB.NET, and other socket libraries such as Apache Portable Runtime using C, Qt using C++, boost using C++, etc. However, it shouldn't be hard to translate .NET sockets from C# into C++/CLI, especially because MSDN has C++/CLI versions of all examples.

e.g. http://msdn.microsoft.com/en-us/library/system.net.sockets.tcplistener.aspx

So get a book on socket programming in C# and use it to learn what the classes are and how they behave, they look up those classes on MSDN to see C++/CLI examples.

Ben Voigt
@Jak/Blender: All that said, if I were writing the program I'd use the winsock API, which is directly available from C++/CLI, instead of the .NET System.Net wrapper. But you asked about the .NET way (or at least prior to Shog9's rewording of the question, it seemed like you were wanting the .NET way).
Ben Voigt
A: 

It is not recommended to use C++/CLI for such kind of application.

pdb
Says who? C++ is great for the kind of bit-twiddling many network APIs requires. And if you want to integrate with other .NET code, C++/CLI is a natural choice.
Ben Voigt
+2  A: 

@Ben Voigt:

Boris Jabes from Visual C++ Team Blog wrote:

"While the lack of Intellisense for C++/CLI is unfortunate, we expect that it only represents a small portion of your source code that you don't need to edit nearly as often as the native code. Indeed, the only scenario we don't recommend is to use C++/CLI as a first-class .NET language. Instead, we think it's the ideal solution for interop."

pdb
What part of this quote are you interpreting as "don't write networking code in C++/CLI?" I assure you that network drivers in current versions of Windows aren't written on the Common Language Runtime, so using the NIC is interop at some level. Furthermore, there are a whole host of advanced networking functions that you'll need access to the Win32 API to use, e.g. scatter/gather I/O or completion ports.
Ben Voigt