/// <summary> /// TCP/IP Server Thread that is listening for clients. /// </summary> private void ServerThreadStart() { // Client Socket variable; Socket clientSocket = null; TCPSocketListener socketListener = null; while (!m_stopServer) { try { if (!IsLive()) { m_stopServer = true; } } catch (System.Exception e1) { m_stopServer = true; LogString(e1.Message); } try { clientSocket = m_server.AcceptSocket(); socketListener = new ASSVServerLib.TCPSocketListener(clientSocket); lock (m_socketListenersList) { LogString("Register Listener"); m_socketListenersList.Add(socketListener); } //Monitor.Exit(m_socketListenersList); // Start a communicating with the client in a different // thread. LogString("Start client thread"); socketListener.StartSocketListener(); } catch (System.Exception se) { m_stopServer = true; LogString(se.Message); } } }
/// <summary> /// TCP/IP Server Thread that is listening for clients. /// </summary> private void ServerThreadStart() { // Client Socket variable; Socket clientSocket = null; TCPSocketListener socketListener = null; while(!m_stopServer) { try { if (!IsLive()) { m_stopServer = true; } } catch(System.Exception e1){ m_stopServer = true; LogString(e1.Message); } try { clientSocket = m_server.AcceptSocket(); socketListener = new ASSVServerLib.TCPSocketListener (clientSocket); lock(m_socketListenersList) { LogString("Register Listener"); m_socketListenersList.Add(socketListener); } //Monitor.Exit(m_socketListenersList); // Start a communicating with the client in a different // thread. LogString("Start client thread"); socketListener.StartSocketListener(); } catch (System.Exception se) { m_stopServer = true; LogString(se.Message); } } }