Decentralized Peer to Peer - network-programming

I am interested in a peer 2 peer decentralized network , I have tried using libraries like pyp2p which required a rendezvous and the likes of https://github.com/macsnoeren/python-p2p-network , since i am not deep in the computer networks domain , I have several questions to ask :
Is it possible to solely communicate with a device only using IPV4 and An open port number without HTTP requests (DIRECT)? IS there a way to do this with socket programming and HTTP requests ? what libraries do you suggest that enable this functionality ?
Is port forwarding necessary for systems like this or can it be bypassed?
which library is best for developing decentralized peer to peer networks in the python language?

Is it possible to solely communicate with a device only using IPV4 and An open port number without HTTP requests (DIRECT)?
Yes, however one issue with direct peer-to-peer is the existence of NAT devices in many networks that block incoming connections.
IS there a way to do this with socket programming and HTTP requests ?
Yes, just open a listening socket on one end, and connect to it from the other.
what libraries do you suggest that enable this functionality ?
This is outside the scope of Stack Overflow questions, but you don't really need any library to create or use sockets. They're provided by the operating system and can be used using the standard library of most languages.
Is port forwarding necessary for systems like this or can it be bypassed?
If there are NAT devices on the path between the peers, you'd need some way of traversing that NAT. Port forwarding is one way of doing that. Look into UPnP and STUN if you want something more automatic.
which library is best for developing decentralized peer to peer networks in the python language?
I honestly don't know. You'll need to do your own research.

Related

Which is the best protocal to use in peer to peer network

I am working on the project that is asking me to use peer to peer network because this project will be applied in the environment that don't have a server. So I need help on which protocal and C/C++ API I can use to perform this.
In order to perform peer-to-peer you have to handle NATs which means you must perform a NAT Transversal (NAT Punch). This is typically done using UDP and STUN. From the second link:
Here’s a parting “TL;DR” recap: For robust NAT traversal, you need the
following ingredients:
A UDP-based protocol to augment
Direct access to a socket in your program
A communication side channel with your peers
A couple of STUN servers
Even then you are not guaranteed success. It is a very complicated subject so i recommend reading the entire NAT Transversal article.

How bittorrent or P2P works independently of the router settings?

This may be a silly question but I was googling a lot last days and I've just found related but not a direct answer to this. In order to express it better let me mention a comparison:
If I setup an http server in a computer behind a router , I must set port forwarding and also that computer must have an static internal IP address in order to receive the requests on that port for that particular IP address. For instance, my router does not allow port forwarding so I could not set it up for the HTTP server. However , Bittorent works like a charm behind that same router without any static IP , nothing. How bittorrent can get requests and it can also seed? How other peers will connect to my computer while seeding? I did verify that when Bittorrent is running the port it uses for example 39031, is actually open ( using yougetsignal_dot_com). How the router can be made to open the port without using its admin settings ( we can also use Bitorrent in a public hot spot where is no way to mess with the router). I know the trackers may do some help, but there are a lot of information about a decentralized way with no trackers or basically that the peers are also trackers but not details on how it works.
Finally, why this "trick" (if any) cannot be used with an HTTP server and we must always depend on the router settings ?
BitTorrent does work behind NAT, to a certain extent. It works better if port forwarding is configured, though.
BitTorrent works reasonably well behind NAT for the following reasons:
BitTorrent is peer-to-peer, and either peer can initiate a connection; therefore, communication will succeed if either of two peers is not behind NAT or properly port forwarded;
some BitTorrent clients are able to automatically set up port forwardings using uPNP or PMP;
modern BitTorrent clients use µTP instead of TCP, and some clients are able to perform UDP hole punching.

iOS objective c socket p2p connection with peers behind NAT

I have to implement socket communication in iOS (Objective-C) between two peers located behind NAT (in different networks). Are there any techniques allowing me to achieve this? Basically I 'm looking for some STUN, TURN implementation, that would allow me find out external IP/Port address.
Thanks in advance,
Leonid

Comparison of P2P Technology

I have gone through various udp based P2P Technology like Stun . I have implemented UDP/TCP hole punching recently for implementing p2p.
I found there are other technology as for like ICE,UPnP and teredo
Can any body tell me what is the difference between these technology.
Which one is the latest technology/protocol used for P2P in recent year.
It will good If any can provide comparative analysis on various UDP based P2P protocols.
Any link or suggestion will appreciated.
ICE stands for Interactive Connectivity Establishment. It is a protocol for NAT traversal (i.e., punching holes) supported by the IETF. There has been several reviews and evolutions of the RFC. Some may find the specifications overkill in general or unclear when it comes to performing TCP NAT traversal.
UPnP is a technology helping local devices finding each other and start communicating automatically. It implements IGD for NAT traversal, which allows remote configuration of the NAT/Router (when possible) to redirect WAN traffic to the device. Unfortunately, this method is a huge threat to security, since any application could hijack NATs/routers to let any undesirable traffic come in.
Teredo is not really related to P2P or NAT traveral. If you have an IPv6 device A on a ipv4 LAN (for example), it won't be able to connect using ipv6 to a remote ipv6 enabled device B located on the WAN. Teredo allows A to communicate with B with ipv6 by transporting ipv6 over ipv4. Teredo is massaging the frictions between ipv4 and ipv6, so to speak.
None of these technologies is 'dominating' P2P for now. It is still a boiling environment.

How to Connect to a VPN Server with Delphi?

I need to connect to a VPN Server , I can`t use windows Connections , My Application should work independently !
I tested some Components using RAS Api , they works ! but by using windows connections .
how can i do that without any dependency to windows connections ?
The problem with this question
"VPN" stands for "Virtual Private Network". It's a way to make a private network available to your computer, possibly in a secure way, so your computer can use standard IP protocols as if it were physically connected to the private network.
The operating system needs to know about that network, so of course all VPN implementations use "windows connections". From a different perspective: When you're connected to a VPN you can open a TCP connection to an IP on the private network as if it were on your local network. Since it's the operating system's job to set up your TCP connection and route your TCP/IP packets, of course it needs to know about the VPN! If it doesn't, it'll simply forward all your requests for the given IP to it's default router and fail with a "no route to destination" message (or a "time out", if your router is not kind enough to tell your system it has no idea what the private IP is).
Can it be done?
From a theoretical point of view, of course, you can bypass Windows completely, but then you'll have to "roll your own" everything. You can't use the Windows IP services, you'll have to implement your own TCP. I'm sure there are about a million other little things that need re-implementing.
For a starting point I'd look at the Open VPN: it's Open Source and available for Windows. It uses the UDP protocol as the bases for the VPN implementation, unlike the Windows VPN (that one uses GRE - General Routing Encapsulation, protocol 47). Open VPN itself, of course, uses a "windows connection" to do it's job, because it aims to provide a useful service, but you can use the source code as the bases for your own implementation.
I personally wouldn't even think about doing this, I'm just showing you the way and proving it's possible.
What should be done
I assume you want some kind of secure communication channel to your own service. Look into simple secure connections, tunneling protocols and proxies.
If this needs to be done for one service on one server, I'd look into a simple SSL implementation. Even better, look into using HTTPS.
If you need to access many different services on possibly different servers on the given private network I'd look into proxies.

Resources