/// <summary> /// Thread method that does the communication to the client. This /// thread tries to receive from client and if client sends any data /// then parses it and again wait for the client data to come in a /// loop. The recieve is an indefinite time receive. /// </summary> private void SocketListenerThreadStart() { m_lastReceiveDateTime = DateTime.Now; m_currentReceiveDateTime = DateTime.Now; var t = new Timer(CheckClientCommInterval, null, 15000, 15000); while (!m_stopClient) { try { var networkStream = new NetworkStream(m_clientSocket); var streamReader = new StreamReader(networkStream); var importId = ConvertHelper.ToInt32(streamReader.ReadLine()); var importInfo = ImportExcelRepository.GetInfo(importId); if (importInfo == null) { continue; } var importProcess = new ImportProcess(importInfo); var thread = new Thread(StartImport); thread.Start(importProcess); //size = m_clientSocket.Receive(byteBuffer); //m_currentReceiveDateTime = DateTime.Now; //ParseReceiveBuffer(byteBuffer, size); //Console.WriteLine(m_oneLineBuf.ToString()); } catch { m_stopClient = true; m_markedForDeletion = true; } } t.Change(Timeout.Infinite, Timeout.Infinite); }
private void StartQueueImport() { while (!stopFlag) { var importId = 0; Monitor.Enter(Messages.SyncRoot); if (Messages.Count > 0) { importId = ConvertHelper.ToInt32(Messages.Dequeue()); } Monitor.Exit(Messages.SyncRoot); var importInfo = ImportExcelRepository.GetInfo(importId); if (importInfo != null) { var importProcess = new ImportProcess(importInfo); var t = new Thread(importProcess.Start); t.Start(); Console.WriteLine(importInfo.FilePath); } Thread.Sleep(10); } }
/// <summary> /// Thread method that does the communication to the client. This /// thread tries to receive from client and if client sends any data /// then parses it and again wait for the client data to come in a /// loop. The recieve is an indefinite time receive. /// </summary> private void SocketListenerThreadStart() { m_lastReceiveDateTime = DateTime.Now; m_currentReceiveDateTime = DateTime.Now; var t = new Timer(CheckClientCommInterval, null, 15000, 15000); while (!m_stopClient) { try { var networkStream = new NetworkStream(m_clientSocket); var streamReader = new StreamReader(networkStream); var importId = ConvertHelper.ToInt32(streamReader.ReadLine()); var importInfo = ImportExcelRepository.GetInfo(importId); if (importInfo == null) continue; var importProcess = new ImportProcess(importInfo); var thread = new Thread(StartImport); thread.Start(importProcess); //size = m_clientSocket.Receive(byteBuffer); //m_currentReceiveDateTime = DateTime.Now; //ParseReceiveBuffer(byteBuffer, size); //Console.WriteLine(m_oneLineBuf.ToString()); } catch { m_stopClient = true; m_markedForDeletion = true; } } t.Change(Timeout.Infinite, Timeout.Infinite); }