private void Listener(object forSS)
{
bool isSS = (bool)forSS;
// Starting to listen to the incoming connection requests
listener = new TcpListener(IPAddress.Any, port);
listener.Start();
while (isListening)
{
TcpClient client = null;
try
{
client = listener.AcceptTcpClient();
}
catch { return; }
// A Connection request from a client is received, HandleClientComm will take it from here
if (!isSS)
{
Thread clientThread = new Thread(new ParameterizedThreadStart(HandleClientComm));
clientThread.Start(client);
}
else
{
Thread clientThread = new Thread(new ParameterizedThreadStart(HandleClientCommSS));
clientThread.Start(client);
}
}
}