Is it possible to encode an application that can detect and connect to peer servers without a central server? How?

Is it possible to encode an application that can detect and connect to peer servers without a central server? How?

I believe that this is what some peer-to-peer applications do, but my programming knowledge is much better than on the net.

Suppose you want to create a private chat application that works as follows:

  • You define a list of identifiers that you trust
  • An application displays all peers that have the same application and have a strong identifier
  • You establish a connection that allows you to communicate and send small documents (source code, individual files, etc.) without having to open a port in the router.

Of course, I do not expect an answer to the silver bullet, just some tips about the features and technology that this will require.

+4
source share
1 answer

It depends on which network of your application will work, for LANs you can do this:

  • A client (or peeer) sends broadcasts on the local network to get a list of available partners.
  • Other online partners will respond to the IP address of this peer broadcast, for example: I am peer ID: xxx and my IP address is 192.168.1.44, with listening port on 4567.
  • Peers now have a list of available connected peers.

Of course, you need to create a broadcast protocol to get a list of available peers. A simple broadcast protocol can have the following parameters: IP address of the peer that requested access to existing peers so that others respond to that IP address, the port number of the broadcast protocol. Available peers will answer this information: IP address, port number of the chat application. The chat application can now use this information to connect to these peers. This applies to LAN networks, but I did not find a solution to identify peers on the Internet, relying on a central server.

Sorry for my English and I hope you have an idea.

0
source

Source: https://habr.com/ru/post/1338234/


All Articles