Вопрос

How can i Make android peer to peer Direct File Transfer without using the intermediate server

I Have tried the app with intermediate server but it is not working please help me.

Это было полезно?

Решение

THis one is actually quite trickey... nearly impossible in many cases.

Basically: To Allow a direct P2P connecion between two devices, one device has to initiate the connection to the other device, which can just answer.

So one device has to open up a connection to an IP-Adress and a Port where the other device is reachable. If you are connected to the same WLAN Accesspoint, you can just display your local IP-Adress on one device and open up a direct connection between the two on any port you want.

If the devices are in different Wireless Networks or one is connected via 3G you have a bunch of problems, starting with NAT. You would have to find a way for one device to read his public IP-Adress (possibly via a STUN-Server) and pass this information to the other client. Then your accesspoint would have to Support UPnP or some similar NAT-Traversal so the other client can reach you, if its not blocked by the ISP, Router or Phone...

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top