AsyncUserToken class is missing in SocketAsyncEventArgs sample: How to make the sample works?
.net, c#, sockets, tcp
Solution
The `AsyncUserToken` class is not part of the .NET framework. It looks like it has been forgotten in the Microsoft sample.
You can create yourself the `AsyncUserToken` class with a `Socket` property (corresponding to the socket used to perform the I/O operations) :
internal class AsyncUserToken
{
public System.Net.Sockets.Socket Socket { get; set; }
}
Problem
I am working on TCP multithread server and client. I found some codes from Microsoft websites: http://msdn.microsoft.com/en-us/library/system.net.sockets.socketasynceventargs.aspx However I got the following error: The type or namespace name 'AsyncUserToken' could not be found (are you missing a using directive or an assembly reference?) I cant find what namespace to include even I searched it on Google, here are those I currently have: ``` using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Net; using System.Net.Sockets; using System.Threading; ``` Thanks for help.