Giter Club home page Giter Club logo

p2pchat's Introduction

#P2PChat

peer to peer chat client, with network discovery and file sharing between connected users

#Contributing IDE: IntelliJ IDEA

  1. click Checkout from Version Control
  2. choose github
  3. login to your github account
  4. Repository URL -> P2PChat.git
  5. set your project directory
  6. clone

you are now good to go.

##Pushing commits It's super easy :D

  1. click VCS from the menu bar
  2. choose commit changes in the dropdown
  3. select the files that you want to push
  4. set you commit message (what you changed)
  5. commit and push

Done! ##Pulling Updates Also super easy

  1. Click VCS from the menu bar
  2. choose update project from the dropdown
  3. click ok on the popup.

Done!

Test change

p2pchat's People

Contributors

colinzeidler avatar moopish avatar danielwhomer avatar

Stargazers

Chenglong Du avatar Sylvia avatar Frank Cash avatar

Watchers

James Cloos avatar  avatar  avatar  avatar

Forkers

sylvia43

p2pchat's Issues

Dialoge Box for connecting to a room/user

A popup box that appears when the program is started,
it will contain a list of all local servers, which when clicked will be connected to.
It will also contain a field to enter the address of the host you want to join

Packet class data should be byte[] not byteBuffer

I have run into a problem using Bytebuffer, with 3+ users

when trying to send a message to multiple users the functions used in the getBytes method empties the ByteBuffer on the first call making following calls fail.

Sending a file

Send the actual file once someone requests it.
should spawn a new Thread since this can take a while

Remove file advertisement

Add the ability for the user to remove on of their file advertisements, may cause issues if a file is already being transferred

add delay between loops for user handling

For the while (true) loop in Controller

  1. choose a delay amount
  2. get time before handleing users
  3. get time after handling users
  4. subtract difference from delay amount
  5. sleep for that time

This will reduce the CPU load of the program

Concurrent modification exception

appeared after calling the incomingCOnnect function
Solution:

  • move the for loop that iterates over the newUsers array outside of the userList forloop

Test loss of network connection

multiple users in room.
one user disables their network connection
this user should remove all other clients from list
all other clients should remove the one user from their list

Testing of UDPRequester

Need to know if it finds all the IPs correctly, followed what the one link you posted did fairly closely

Loop for incoming messages, from clients

Controler.run() should handle this at the bottom
create a new function to call from run to keep stuff tidy

loop through all Users contained in Model
read from stream, if null continue to next (the sockets SoTimeout must be set, best is probably 1)
if not null, data should be a number (0 = text, 1 = file advert, 2 = file request, 3 = connect)

  • text
    • readline (this is the actual message)
  • file advert
    • readline (this is the file name)
  • file request
    • send file size
    • send file
  • connect
    • readline (address to connect to)

Packet Class

Handle logic for encoding text OR file data

NOTE: Not the actual transfer of the data itself

writePacket and readPacket

Functions for writing and reading Packet objects with Input and Output streams

Within the user class 'sendText/File' functions need to be changed to incorporate this.

Thread to listen for incoming UDP packets

This is the "server" that allows for network discovery
check the text of the packet, and if correct respond

incoming message: p2p_chat_discovery_packet
outgoing message: p2p_chat_discovery_response

Test leaving a room

all users should remove the user who left.
User who left should not show anyone as being in their room

Change how the messages are constructed

currently message is assembled in the User class
this means that it must be done for every user in the room. which may be quite a lot.
This can take lots of time, also the only part of the sendText function that is client specific is the actual sending

better format is to create the full message string in the getSendListener function. then loop through all the Users and sendText them.

Sending messages to connected users

And an action handler for the ui that will send data when the send button (or Enter) is pressed
View class needs a get message text function

  • clears the message field
  • returns the text that was in it

in the Controllers getSendListener

  • call the views get message function
  • add that message to the model
  • loop through all users and call sendText(message)

Allow disconnecting from room / connecting to new one

disconnect, and connect should be options in the menu bar
disconnect will d/c the user and then bring up the connection dialoge
connect will bring up the connection dialoge, and only d/c if the user chooses a new room to connect to

remote clients are unable to remove file ad

Client 1,2 are connected
Client 1 advertises file
Client 2 can see the file
Client 1 removes the ad
Client 2 says Failed to remove advertisement on file! Not Removed!

error appears to occur in Controller.java: line 137 (myModel.removeFile(removeFile))

Thread to listen for incoming connections

This will find people who are joining.

  1. accept user
  2. tell user how many users are in room
  3. tell all other users to connect to new user

since this is on a new thread will have to be thread safe when modifying user list

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.