I am using
ServerSocket(8080,1,InetAddress.getByName(“127.0.0.1”))
Now in the accept method I obtain the Socket from SS. My question is once I get the Socket and continue with my processing if another request comes in before my processing is complete, will ServerSocket accept that request?
Update: I have a while loop as in the answer below which accepts the connection. My doubt is with this instantiation if I continue with processing of my request and if another connection request comes in will it be accepted?
Since you have constructed this ServerSocket with a backlog of 1 there may be only one unprocessed (not
accept()ed) connection at a time. All additional connection attempts will be refused. In other words, the backlog parameter specifies the size of a queue which stores connections until they are accepted by your program.