Coder Social home page Coder Social logo

library_lookup's Introduction

Library_Lookup

Book queries utilizing TCP sockets in Python 3.0

Description

This project consists of four programs: lib_app_bookSrv.py(book server), lib_app_userSrv.py(user server), lib_app_librarian.py(librarian server), and lib_app_client.py(client app). The 4 programs together create a library application that can be supplied with a JSON input file of book names and it will return information about each book.

To run the project:

  • Execute run_app.bat

or

  • Open 4 command prompts. Start each server with: python3 lib_app_servername.py
  • In the last command prompt execute the client application:
    • Usage: python3 lib_app_client.py "<inputFile>"

Troubleshooting

If a port is already in use on your machine, you can modify the port for that program. Each program defines a global variable at the top that specifies the port. If you change the port for a server, be sure you change the port in the client program as well.

  • Server: lib_app_librarian.py
    • Client: lib_app_client.py
  • Server: lib_app_userSrv.py or lib_app_bookSrv.py
    • Client: lib_app_librarian.py

Each lookup consists of the following:

  1. The client server sends a hello message to the librarian server.
  2. The librarian server sends a welcome message.
  3. The client sends a BookInquiry to the librarian server.
  4. The librarian server forwards the query to the book server.
  5. The book server receives the query, looks up the book, and responds with pertinent info.
  6. The librarian server forwards the answer to the client.
  7. If the book Status is borrowed, the client sends a UserInquiry to the librarian server.
  8. The librarian server forwards the query to the user server.
  9. The user server receives the query, looks up the user, and responds with pertinent info.
  10. The librarian server forwards the answer to the client.
  11. The client prints the details of the book and optional user query to the screen.
  12. After all queries are made, the client will write them to a file in the current directory named “output.json”.

library_lookup's People

Contributors

watson-js avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.