Implement an in memory key value datastore server with the following features:
The program should create a socket which listens on port 60## (where ## is your user number). A
client program NEED NOT be written to connect to the socket. telnet can be used. Once connected to
your program it should support the setting and retreival of keys:
set hello world
“Printing list of keys”
Create a second instance of the same program running on a different port
Write a client that is capable of taking input values from a file / telnet
Your client must be able to intelligently shard data across the two instances of your program via
“Start two instances of your server – A and B”
SET raghu 21 # Data goes to server A
SET bharath 23 # Data goes to server B
SET ayush 22 # Data goes to server A
SET kalyan 24 # Data goes to server B
If there is a ttl value set for the key, it should be deleted from the memory once ttl is expired.
set hello world 60
In the above case the key hello should be deleted, 60 seconds after it has been set.
Hints for C/C programmers
Common function calls you will need
socket (Refer man 2 socket )
listen (Refer man 2 listen )
bind (Refer man 2 bind )
Feel free to use C STL library to make your coding.
please provide the detailed explanation to the problem and also the solution.