views:

60

answers:

1

Sometimes back I had to work on plain TCP/IP client-server application using just .Net framework 2.0. I found that .net 2.0 socket library was quite inefficient and used to take lot of memory and processing cycles we then switched over to C++ and it worked very well.

I want to check if there's been any improvements for TCP/IP library in .Net 3.0 or above. What is your experience in case if you have used .Net TCP/IP library for both .Net 2.0 and .net frameworks after 2.0 ?

A: 

I've not had any problems with the basic Socket class; as "nos" pointed out, it's just a really thin layer over the WinSock API.

They did add the whole *Async / SocketAsyncEventArgs - based API to Socket in .NET 2.0 SP1 (note that this should not be confused with the Event-Based Asynchronous Pattern, which uses *Async, *Completed, and *AsyncEventArgs naming conventions). The point of this API is to reduce stress on the GC by reusing native OVERLAPPED structures instead of having to allocate and GC them on every read and write.

I have not actually used the *Async API; I use the Begin*/End* API and have not had any performance issues of note. To my knowledge, no changes were introduced to the Socket class since 2.0 SP1.

Stephen Cleary