Multiple Pings through Redis-Cli only able to parse single ping

I’m stuck on Stage #( Build your own Redis, Build Multiple Pings. ). For multiple pings, my solution is only returning single pong.

I’ve tried below piece of code.

1. Read other solutions and tried those but same issues is reoccuring.
2. parsing input using java BufferedReader and for every ping encountered I am 
outputting pong using java's print writer.  

Here are my logs:

❯ echo “PING\nPING” | redis-cli
PONG
(3.51s)

And here’s a snippet of my code:

            BufferedReader bf = new BufferedReader(new InputStreamReader(clientSocket.getInputStream(), StandardCharsets.UTF_8));
            while(bf.ready()) {
                String s = bf.readLine();
                if (s.equalsIgnoreCase("ping")) {
                    printWriter.write(HttpResponse.getPong);
                }
            }

@mainaksethi mind sharing the full code you’re using? What is bf in this context? You can publish to GitHub if that’s easier: Publish to GitHub - CodeCrafters

@rohitpaulk published it here. Updated the code as well.

hi @rohitpaulk . Gentle reminder for having a look over the above solution.

@mainaksethi Just checking, do you still need any assistance with this?

Closing this thread due to inactivity. If you still need assistance, feel free to reopen or start a new discussion!

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.