X
Xarky
Hi,
I have the following scenario
private void StartListen()
{
Socket mySocket;
Byte[] bytesReceived;
string stringReceived;
while (true) // terminated only, when thread is killed
{
mySocket = mainListener.AcceptSocket();
if (mySocket.Connected)
{
bytesReceived = new Byte[1024];
mySocket.Receive(bytesReceived, bytesReceived.Length, 0);
stringReceived = Encoding.ASCII.GetString(bytesReceived);
Thread clientThread = new Thread(new
ThreadStart(handleClientRequest));
clientThread.Start();
clientThread.IsBackground = true;
} // end if
} // end while loop
} // end method StartListen
private void handleClientRequest()
{
....
}
When the new thread is launched I would like to pass mySocket and the
stringReceived to that current thread just created.
How can I handle that.
Thanks in Advance
I have the following scenario
private void StartListen()
{
Socket mySocket;
Byte[] bytesReceived;
string stringReceived;
while (true) // terminated only, when thread is killed
{
mySocket = mainListener.AcceptSocket();
if (mySocket.Connected)
{
bytesReceived = new Byte[1024];
mySocket.Receive(bytesReceived, bytesReceived.Length, 0);
stringReceived = Encoding.ASCII.GetString(bytesReceived);
Thread clientThread = new Thread(new
ThreadStart(handleClientRequest));
clientThread.Start();
clientThread.IsBackground = true;
} // end if
} // end while loop
} // end method StartListen
private void handleClientRequest()
{
....
}
When the new thread is launched I would like to pass mySocket and the
stringReceived to that current thread just created.
How can I handle that.
Thanks in Advance