Hi,
I am using asynchronous socket (BeginAccept for example).
I tried to name each thread I am using but threads created by
asynchronous Socket functions (like BeginAccept) creates "anonymous"
threads.
I named the thread (see sample code below) in Accept callback started by
BeginAccept but all connections accepted run in a thread that has the
same name !
So, even a new thread is not started by BeginAccept, even my naming is
wrong.
Thanks in advance for your help.
code:
...
Socket server = new Socket (AddressFamily.InterNetwork,
SocketType.Stream, Protocol.Tcp);
...
server.BeginAccept (new AsyncCallback (AcceptConnection), server);
...
void AcceptConnection (IAsynResult iar)
{
Socket server = (Socket) iar.AsyncState;
Socket client = server.EndAccept (iar);
Thread.CurrentThread.Name = "TCP Accepted on #" +
client.RemoteEndPoint.ToString ()
...
}
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!