private void HandleChat() { int buffSize = _clientSocket.ReceiveBufferSize; byte[] bytesFrom = new byte[buffSize]; while (true) { NetworkStream networkStream = _clientSocket.GetStream(); networkStream.Read(bytesFrom, 0, buffSize); String data = System.Text.Encoding.ASCII.GetString(bytesFrom); data = data.Substring(0, data.IndexOf('$')); Console.WriteLine(data); TcpConnection.getInstance().Broadcast(data); } }
static void Main(string[] args) { TcpConnection.getInstance().Start(); }