Introduction (Phase Two)
For the phase two, the peer-to-peer part, you are required to enhance your program in phase 1. Based on the element in phase 1, you need to add peer- to-peer features into your program. Your program shall be able to do network searching, audio streaming.
You may still improve your phase 1 part during this phase.
Basic Requirements (Phase Two)
- Network connection
Your program should be able to connect to other PCs using TCP/IP network stack. You can use any method to get the IP address of the connectable PCs except hard coding. (For example, manually inputting IP address, using tracker server, or broadcasting are considered appropriate). The network should support at least 3 terminals. - Music searching
Besides local music searching, network searching should be supported in this phase. The searching interface should be the same one as those in phase 1. What’s more, your program should search the audio files not only in the local database but also in the database of the other PC that is connected to your program. All the results from both local database and network database should be displayed in the same list control of the UI. Duplicate results (e.g., different computers have the same audio file) must be displayed only once. - Availability check
As user may not know where the audio is, when the user selects an audio from the searching results, the program should check whether the audio file exists locally or not. If the audio file exists, your program shall playback the audio directly. Otherwise, your program will stream the audio file from other computers. - Real-time audio streaming
When the program is doing streaming from the other computers, your program should automatically play the audio as soon as possible when it
1
receives a piece of audio data (after certain amount of buffering). You are only allowed to buffer no more than 50% of a music file before you play the music.
5. Peer-to-Peer playing
Your program should be able to receive one audio file from at least two other computers simultaneously. The audio data from different computers should be played in an interleaving way. For example, suppose PC1 wants to play a file and it cannot be found locally. It should get audio data from PC2 and PC3, the file is divided into (at least) 4 parts, and PC1 may get the first part from PC2, the second part from PC3, the third part from PC2, and the fourth part from PC3.
To verify the interleaving feature, you should also implement a function in your project to show your interleaving feature using images. We will give you images in different colors but have the same file name in bitmap format with the same resolution. Let’s say PC1 wants to download this image from other endpoints in an interleaving way; you must achieve that your data are completed but collected from different endpoints. The bottom figure shows the example of interleaving feature.
Same audio from different PCs
Example of interleaving feature
2