A
A
Andrey2020-11-28 23:33:32
Java
Andrey, 2020-11-28 23:33:32

How to allocate a new thread for a new client?

Actually I can not make that each client "processed" the stream.
The bottom line is that there are segments with a certain step, there are n-th number of clients, if the client is free, he requests a segment and finds the numbers. The essence of the problem is below.

The server starts and waits for the client(s) to connect, the client, having connected to the server, receives from it a serial number and an interval of 1000000 in length and returns the found numbers to the server. Provide output of console messages on the server side.
Stages of the task:
The server is waiting for an unlimited number of clients to connect. Clients do not stop working after solving one task, but wait for additional tasks from the server. It is necessary to provide for the possibility of adding tasks on the server through the console in the LR Step format (find the number of numbers in the segment [L,R] that are divisible by 11, 13 and 17, dividing this segment into pieces of length Step. The last piece may have a shorter length).

Here's what I got. Only here the step between segments is not implemented, because it is tied to the main question about flows.

Link to sources

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question