tags:

views:

543

answers:

4

I have a server-side project which must be developed on .Net platform, but I doubt about the c# socket performance, some guys told me that C# application always eat a lot of memory, especially when constantly exchanged large bunch of data in real time. the memory data recycle is too slow. anyone give some ideas about C# socket performance?

+1  A: 

I would stick to the C# layer. It's a safer environment, from an error handling perspective and I don't believe you will see a significant performance impact if your socket and thread models are properly crafted (just as you would have to do from C++).

Jim Rush
+4  A: 

C# Sockets have no noticeable performance penalty.

Unless your application is constantly CPU bound, you'll benefit more from the safety implied by a C# solution than any performance benefits of an unmanaged C++ one.

Kevin Montrose
doesn't C# socket need to pay attention to memory leaks?
speed.zheng
The .NET framework does a very good job at handling memory for you and preventing leaks
Paul
+3  A: 

It's up to you. Some people may say that C# has better built-in functionality because it is wrapped and encapsulated better. To me, it's a personal choice. When I am starting a new project in .NET, I choose C#. On an older application, I use C++ Builder 5 with Socket Communication and it is just as fast and performs just as well as the C# version. In the C++ version (which is encapsulated as the C# would be), there are events that provide error handling due to loss of network connection or some other error on the socket. The bottom line to me is that I would not base the language choice of your application on sockets.

0A0D
A: 

Use C#. Managed C++ is bad at best. Anyhow, if you're designing a server-sided application, resource usage won't be (for example) exponential. You can upgrade linearly like you would no matter what sockets implementation you use.

In the end, it's nothing you can't fix by throwing hardware at it.

Clark Gaebel