Coder Social home page Coder Social logo

socketstcp's Introduction

socketstcp

BUS BOOKING SYSTEM

AIM: To use sockets and establish a client-server connection using TCP connections between them.

Mainly our project aims to use sockets and do a back end for a bus booking system.We have used the basic socket package provided in python 2.7 along with threads and psycopg2 which is the python client for PostgreSQL.
Our approach was to create threads for each process (i.e., client) and thereby define a class with a default run function which runs on every execution of the server file.
We have created a database named bus_ware in postgresql which has three tables bus_info which has the list of all the buses, route_table which has the routes for each bus between destinations and at last a seats table which has the seats information for a given bus on a requested date.
In the client side we take the required information and receive it on the client side and thereby perform queries in the postgres database and fetch the results using the fetchall function and send the fetched information to the client.After each query we commit the changes on the database.

    Features or the execution order of a transaction:

  • We ask the client for the service either reservation or cancellation
  • If reservation, we ask for the date of journey
  • Then we ask for bus type either SLEEPER/SEMI_SLEEPER/SEATER
  • Then followed by the ac_provision AC/NON_AC
  • now, mainly the source and the destination
  • We send all the above information to the server and then display list the buses available between the desired stations.
  • The user selects the bus ID for the journey
  • Followed by the display of seats, he selects the required seat
  • Fare is Displayed followed by the confirmation of the ticket.
  • We have taken care of the intermediate vacancy of the seats i.e., a passenger can board a bus and take a seat which is vacant after a passenger gets down at a previous stop.
    For this we have used files and managed to save the information of all the passengers along with their phone number, seat info, drop point.
  • We have just taken the phone number for present to keep track of the passenger and his booked seat on a particular date.
  • We then provided the option of cancelling the ticket which updates the database in the back-end
  • In our policy we return back half of the fare to the passenger after cancellation.

SETUP:

  1. Install postgresql in your linux system or windows
  2. Install its python client psycopg2 (pip install psycopg2)
  3. In the server.py, we have connected postgres with my password, so just do a alter user and set your own password and then run it.
  4. Insert the tables given in datedb.sql else you can create one of your own but make sure to change the server.py accordingly.
  5. Run server.py and client.py parallely in two terminals and see the results.

    Further improvements:
  • Mainly create a GUI
  • Authenticate each user, else there will be security issues.

Ignore the team information

socketstcp's People

Contributors

gagancj avatar sameerg07 avatar

Watchers

James Cloos 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.