private void THSocketConnectWait() { while (mListen) { WClient sclient = new WClient(tcpServer.AcceptSocket()); Thread thWaitData = new Thread(new ParameterizedThreadStart(THSocketDataWait)); thWaitData.Start(sclient); } }
private void THSocketDataWait(object osclient) { WClient sclient = (WClient)osclient; while (sclient.Soket.Connected) { byte[] dataArray = new byte[8192]; int dataCount = sclient.Soket.Receive(dataArray); string dataStr = Encoding.Unicode.GetString(dataArray); if (dataCount > 0) { if (ReceiveData != null) { ReceiveData(sclient, dataArray); } } if (dataCount == 0) { break; } } }