2

How can the server code keep track of clients. I am unable to understand this: if a client A and client B are continuously sending request to the server, how will I know which one is client A and which one is client B ??

please help.

my server code is:-

while (true) {
            try {
                System.out.println("Connecting " + count++);
                Socket client = acceptor.accept();
                System.out.println("here 1");
                logger.log(Level.INFO, "Client ["+client.getInetAddress() +"] tried to connect at "
                        + new GregorianCalendar().getTime());
                logger.log(Level.INFO,
                        "Connection received from  " + client.getInetAddress()
                                + ":" + client.getLocalPort() );
                processRequest(client);

}

1 Answer 1

1

It depends on how you want to code it. I had faced same situation where we had client server session based on log-in.. So untill they are logged in its easy to understand.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.