服务器代码如何跟踪客户端。我无法理解这一点:如果客户端 A 和客户端 B 不断向服务器发送请求,我怎么知道哪个是客户端 A,哪个是客户端 B?
请帮忙。
我的服务器代码是:-
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);
}