Git Product home page Git Product logo

peer2peer's Introduction

Peer2Peer

A peer to peer communication using java UDP sockets

I have implemented a class called client that uses Datagram sockets to connect with peers and chat with them. The Client class contain two threads one for input, and one for output. This way a user can send messages, while receiving messages from others at the same time. When the Client is created is first asks the user to imput his username. This way, when he sends messages his peers will know who has sent them. When the input thread is starts, it will first use a method called addNewReceiver() which ask the user for a port number and then adds a new datagram socket to the list of sockets every input thread has and then ask you for his name so it can update it in the lyst of names..

How to work with the input thread:

  1. you need to write the index of the reciever, this way the program will know where to send the message.
  2. you need to write your message separated from the index with space.
  3. if there is no user a that index, the proram will call addNewReceiver() and you will create a new peer.
  4. After a new peer is created the program will tell you his index in the list.
  5. write . in the input to exit
  6. write look to see your list of names.
  7. when exiting the you will automatically send a signal to your peers and they will remove you from their lists.

peer2peer's People

Contributors

valentin-piralkov avatar

Stargazers

Fernando Machado 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.