/single-server-key-value-store-tcp-udp

A server program that serves as a key-value store. It's set up to allow a single client to communicate with it and perform three basic operations: 1) PUT(key, value); 2) GET(key); 3) DELETE(key).

Primary LanguageJava

Single server key-value store (TCP & UDP)

A server program that serves as a key-value store.

It's set up to allow a single client to communicate with it and perform three basic operations:

  • PUT(key, value)
  • GET(key)
  • DELETE(key)

Usage (locally):

  1. Open up two terminal windows and navigate to /Project1/src
  2. In one window, type javac servers/*.java (hit ), followed by java servers.Main <Port#> <TCP/UDP>, where <Port#> is the port number the server advertises its service with, and <TCP/UDP> instantiates the type of server that communicates with the TCP or UDP protocol (hit )
  3. The server is now running
  4. In the other window, type javac clients/*.java (hit ), followed by java clients.Main <Hostname> <Port#> <TCP/UDP>, where <Hostname> can be either the server's hostname or IP address, Port# is the port number the server advertises its service with, and <TCP/UDP> instantiates the type of client that communicates with the TCP or UDP protocol (it has to match the server's) (hit )
  5. The client is now running
  6. The predefined protocol is:
    • PUT:key:value(hit )
    • GET:key(hit )
    • DELETE:key(hit )
  7. To shut down the server, type server stop(hit ) or server shutdown(hit )
  8. To shut down the client, type client stop(hit ) or client shutdown(hit )