RMIT Logo

P2P Application Guide

Introduction Setup Peer Server Centralised DHT Presentation Architecture-Basic Architecture-Operation

Centralised P2P System

The first use of this set of programs is to create a P2P Chat System. Although the system is essentially P2P, it does use a server to relay information ABOUT each peer to each other during the initial connection phase. This is known as a Centralised P2P System.

When a peer first connects to the system, it registers via the server. This server then adds this new peer to its global peer list (containing vital connection details such as the IP address and port of the peer) and then distributes the new peer list to every peer currently in the system.

Once a peer receives this list of peers from the server, it becomes aware of all of the other peers in the system and then can directly send message packets to other peers and essentially "chat" to each other.

This is essentially the spirit of Centralised P2P. A server is used to pull together peers and allow them to learn about each other however, the majority of the workload (the actual messaging between peers) does not require any assistance from the server. This method stands in contrast to a Client-Server model where a server would relay messages between clients.

The following demo will instruct you on how to use the P2P Peer and Server applications to create a small example of a centralised system on a single local machine.

NOTE: If you are planning to run multiple instances of the P2P Peer to connect with each other, it is recommended that you make a copy of the entire ChatClient program (as many as are needed) and run it from there. The programs log all their network traffic in a file titled "log.txt" which can cause I/O issues when multiple instances of the program try to edit the same file.

Starting your own Chat Server

  1. Run the P2P Server application.
  2. If you have a desired address/port combination, then enter these details, otherwise the defaults should be fine. If you have a Presentation Server running, then enter the IP address and port number for it, otherwise, leave the default values as is.
  3. Click the Login button. You should see the server interface appear.
  4. Starting a Chat server.

Joining a Chat Server

  1. Run the P2P Peer application.
  2. Enter the address and port connection information for the running server that you are attempting to connect to. If you have a Presentation Server running, then enter the IP address and port number for it, otherwise, leave the default values as is. Be sure to type in a unique username.
  3. Click the "Login" button. You should see the chat interface appear.
  4. Joining a Chat server.

Chat with other peers

  1. Ensure that you have logged your Peer application into an existing server.
  2. Choose which user you wish to chat to. Double click their name in the peer list on the right hand side of the interface. A chat tab with their username should appear on your screen. You can switch between existing conversations between users by clicking on these tabs. Tabs can be removed by double clicking the name of the peer in the peer list.
  3. Adding a tab.

  4. Type a message into the chat text field and then proceed to click the Send Message button.
  5. Typing a message.

    Sending a message.

Send files to peers

  1. Ensure that you have logged your Peer application into an existing server.
  2. Choose which user you wish to send a file to. Double click their name in the peer list on the right hand side of the interface. A chat tab with their username should appear on your screen. You can switch between existing conversations between users by clicking on these tabs. Tabs can be removed by double clicking the name of the peer in the peer list.
  3. Still on tab.

  4. Click the Send File button.
  5. Selecting a file.

    Sending a file.