views:

609

answers:

1

Please do i need a new SocketAsyncEventArgs for each client connection i make.

I'm making several client connections in a loop, filling in the UserToken for each clients state from a database.

Is there a way to reuse the SocketAsyncEventArgs and still maintain separate UserToken state for each connection.

Thanks.

+1  A: 

This question is slightly old but it's still relevant in my opinion. I suggest the following links for reference:

I do recommend the codeproject link as the server implements a SocketAsyncEventArgs pool (which answers your question). Do note however that that code has issues that need to be resolved.

Fake Code Monkey Rashid
The documentation for this new class from MSDN don't help much and Google gives very little.I guess people are still using the 2.0 socket classes and have not yet seen the need to move to the new socket programing model provided for .net35.This is unfortunate, since MS claims that the performance and scaling benefits from this new model are really good, and it is mentioned as a feature highlight of .net35
CharlesO