In this article, we will talk about how to implement a peer-to-peer network via Bluetooth on Android. We will find out what the peer-to-peer is and why it was invented.
Peer-to-peer is a computer network, the members of which have equal rights. Typically, there are no dedicated servers. Each host is a client and it may perform the functions of the server. If you organize the network using such a method, you will be able to connect to any number of nodes and still maintain full functionality.
Possibilities and disadvantages
You will need to create P2P via Bluetooth on Android in such cases:
- There is a necessity of establishing such a network when there is no accessibility to the Wi-Fi and mobile operators (outside the city, in the subway).
- To create games on mobile platforms.
The disadvantage of this technology is that it can be maintained separately with the Google devices and separately with Apple mobile devices, because the iOS has the system limitations for the Bluetooth.
That is why standard tools were divided to pair the devices via Bluetooth: the Android uses the Bluetooth API and iOS uses the Game Kit Framework. These technologies allowed pairing two devices, but that did not solve the problem.
The new protocol was created by the DB Best Company. It allowed pairing six devices via Bluetooth. Thus, each participant could exchange information with others in real-time.
The Bonjour technology, which was created for the iOS, removed the restriction in the number of connected devices.
Where can we use the peer-to-peer network
P2P technology, as mentioned above, is used in games to allow two and more players to play simultaneously. This differs from the situation when you pair only two devices to exchange data.
How to create the peer-to-peer network via Bluetooth
Note that not every gadget supports such technologies, although they became widespread. In theory, in order to create such a network, you will need a special application. In future, such instruments will be built into the Android operating system initially. Sadly, such technologies have not reached our country yet.
Currently, you have the opportunity to create a PAN network. In the PAN network, there is a host device and other devices are connected to it. That it will act as a server, but not as the usual server. For example, you connect four smartphones (tablets) to the PAN network. The first device will be the main. Other devices connect to it. Further, the rest of the devices can be connected to each other and exchange information via the first gadget. In simple words, the first smartphone/tablet will act as a router. All this is only a theory, and everything is not fully thought out and realized in practice.
Bluetooth in modern smartphones and tablets is quite able to connect to two devices at the same time, and you can use the various functions. However, the developers have not provided an application for managing files and the entire network in general. For example, programs such as uTorrent, DC++ etc. However, these programs were written for Windows-based computers. There are no similar apps for Android OS.
When it comes to games, everything is easier. You just need to enter the game and create a server (just as it is done on the computer in online games, in which one computer creates a game and others connect to it). The data exchange is performed according to the same principle. The special app is needed for it. Using it, we can share, find and transfer the necessary information.
Of course, this is not a peer-to-peer network that was meant originally. However, considering that the technology is new, this method can be regarded as another step towards its realization and implementation. So far, smartphones/tablets are not able to connect to multiple gadgets via Bluetooth simultaneously and create peer-to-peer networks, but soon it will be implemented without third-party applications. Then you will be able to take full advantage of P2P networks for your own purposes.