tags:

views:

165

answers:

2

Hi, I'm doing a little research in developing a simple socket server that will run as a windows service. I'm going to write this in C#, but I've been made aware that .Net sockets are slllooooowwwww. For the initial roll out using the .Net Networking classes will be fine, but I'm wondering if anyone has experience with a high performance (and hopefully free) socket library. I'm thinking probably something written in c++ that I can use as a com object in .net.

I've used indy sockets before, but it doesn't look like there is any active development going on with the project anymore. I've done some googling and I've found a few libraries, but I was hoping to get feedback from someone who has actually used a socket library with good success.

Any help appreciated. Thanks.

+2  A: 

Sounds like you are optimizing before you need to. I would go ahead and build it with .NET and see if you have a performance problem before you try to do something that would potentially be slower. COM has a lot of overhead.

lambacck
Good point. I'll give the .net classes and try and see how far the get me.
infocyde
+2  A: 

I would revisit your initial assumption - I don't believe it's accurate.

In my experience, the overhead of using .NET's framework socket libraries is not high - they perform quite well. The main cause of very slow socket code, that I've seen, is when people try to port non-C# code into C# directly, in particular, trying to port synchronous C++ socket code. The sockets in .NET's BCL are all designed to be used asynchronously. If you try to force them into a synchronous model, you'll end up adding quite a bit of blocking, which definitely causes very slow code.

Try using the socket classes the way they were designed - I think you'll be very happy with the performance, as well as the usability.

Reed Copsey
Thanks for the answer. My initial experience with .Net sockets was way back in version 1.0, and I didn't really know what I was doing back then either. I'll give the built in classes a try.
infocyde
Depending on what you're doing - there are many nice classes for handling sockets and networking in .NET now. In particular, take a look at WCF - it may make your life much, much easier than you'd ever expect (depending on the project). Sockets in .NET (esp. post 2.0) are very good.
Reed Copsey