Start number: 06
Documentation
Architecture:
- When
the user click „Listen!”
the server divide the work (“DivideWork” procedure) and start listening
for the clients.
- When
the client is connected to the server, send „Request“ to the server
- Then
the client receive „NewWork“ and calculate it („Calc“ procedure, which use
„IsPrime“ function).
- After
the client is done, it send the „Result“ back to the server.
- Server
return „ReceivedResult“ to the client.
- Client
after that send „Request“ back to the server.
- When
the Client ask for the prime numbers in the intervals (paragraf 5 in the
task), send to the server „GetPrimeNumber“ with intervals
- The
server close the file and open it for read. Read number by number and if
the number is in the interval, it will add it to the list and then sent it
to the client (after close the file and reopen for write as append)
- Server
return only part of the list (long text is divided to packet – I don‘t
want it), the client ask for next part „GetNextPrimeNumber“ (see
Communication for more information)
Communication:
- The „::“
is divider between the SendText (send information)
- The „||“
is divider between the texts
- The
first text is identificate sent data
- „Request“,
„ReceivedResult“ – no more information
- „Result“
– next information is count (x) of prime numbers and next x
numbers are founded prime numbers
- „NewWork“
– next informations are „From“ and then „To“ to calculate
- „GetPrimeNumbers“
– next informations are „From“ and „To“ of the interval
- „GetNextPrimeNumbers
– next informations are „LastPrimeNumber“ (the last one in the received
list – the server will skip all prime numbers before this when parsing
output file and sending next part of the list), „From“ and „To“ of the
interval
- „ResultPrimeNumbers“
– as „Result“ (count + numbers)