private void escucharChat() { byte[] bytesFrom = new byte[tamañoBuffer]; string datoFromCliente = null; while (true) { try { NetworkStream networkStream = clientSocket.GetStream(); networkStream.Read(bytesFrom, 0, clientSocket.ReceiveBufferSize); datoFromCliente = Encoding.ASCII.GetString(bytesFrom); datoFromCliente = datoFromCliente.Substring(0, datoFromCliente.IndexOf("$")); SocketServidor.notificarClientes(datoFromCliente, nombreCliente, true); } catch (Exception e) { Console.WriteLine(e.Message); } } }
static void Main(string[] args) { SocketServidor.Conectar(); }