Giter VIP home page Giter VIP logo

cs4065_project2's Introduction

Authors

David Lewis, Isaac Poplin

See the git repo here

Usage

Some of the usage instructions for the client are different from what was given in the assignment, refer to the README in the Client directory for more info.

To start the server:

server

To start the client (it should walk you through it):

client

Getting up and Running

To run the programs in the repo, you can either go the nix route (probably easier), docker route (also fairly easy), or the manual route.

Nix route

Note: the .nix files replace the tradition Makefile, the only thing you need to install is nix, it will handle all dependencies

  • Install nix for your favorite Unix/wsl2 operating system. (macOS is untested).
  • Enable flakes by running echo experimental-features = nix-command flakes >> ~/.config/nix/nix.conf or by adding the --experimental-features 'nix-command flakes' flag right after nix in the following commands.
  • Assuming that you are in the root of this repo, run nix run .#client -- <cli or gui> to run the client
  • run nix run .#server to run the server

Docker route

note that the docker image can be generated using the nix build .#docker command if you really want the container separately

Get the docker file here

Assuming you have the docker image file

  • docker load -i image

If you want the gui to work you'll need wsl2 on Windows 11 (untested) or a Linux environment:

  • you'll need xhost (sudo apt install x11-utils)
xhost +
docker run -it -v /tmp/.X11-unix:/tmp/.X11-unix \
                -v /mnt/wslg:/mnt/wslg \
                -e DISPLAY \
                -e WAYLAND_DISPLAY \
                -e XDG_RUNTIME_DIR \
                -e PULSE_SERVER \
                csproject:latest

Otherwise, you can just do:

run -it csproject:latest

Note: you may need to add --network host to the docker command like so:

run -it --network host csproject:latest

You can connect to an existing instance of the docker container with

docker exec -it <container name> bash
client cli
client gui

While in the container you can run server to start the server and client to run the client.

If you want server and clients in the same shell, do something like:

server > serverlog.txt&
# gui
client gui&
# cli (only one per shell)
client cli

note: I do not recommend this

Manual route

note that this method is untested, but it should work "in theory"

Prerequisites

  • At least python 3.9 (tested with python 3.10)
  • cmake (tested with version 3.25.1)
  • Some cmake compatible C++ compiler for the operating system of choice

Building/Running

  • First follow the build instructions in the README of the Protocol directory.
  • Then follow the build/run instructions in each of the Client and Server directories

Major struggles

  • Making the client and server mature at the same time was very difficult. It involved a lot of back and forth between teammates to ensure we were implementing the right kind of communication

  • client gui was more difficult than anticipated, I also chose a very limited gui framework by accident, and haven't really worked with GUIs a lot before. I'm pretty happy with the final result though.

  • Lots of work was due to different development environments (windows 10 vs linux+nix) and the associated compatibility issues Eventually settled on updating the socket abstractin library we created to work for windows and linux Also used docker+wsl2 to test on windows 10

  • The communication protocol was the first part of the project developed and implemented, so several times we had to go back and change a major part after realizing it wouldn't work well when implementing some part of the client or server.

cs4065_project2's People

Contributors

scotty1701 avatar illustratedman-code avatar

Watchers

 avatar

cs4065_project2's Issues

Server can't handle ungraceful client exits

When the client exits without closing its socket, it sends the server into either an infinite loop, or the following error occurs:

terminate called after throwing an instance of 'std::runtime_error'
  what():  Bind failed with error: 98
[1]    498135 IOT instruction (core dumped)  nix run .#server

Interestingly enough, the above error makes the server unable to start again for a while

Server

  • Needs a list of all connected clients
  • Multithreading
  • once a user leaves the group, server notifies all other users in the group
  • once a user joins, they can only see 2 previous messages.

Protocol

Part 1

Post

  • Message ID
  • Sender
  • Post Date
  • Subject
  • Content

connect

  • address
  • port number

join

users

leave

message

exit

Part 2

groups

groupjoin

grouppost

groupusers

groupleave

groupmessage

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.