开发者

Transfering data between two Android devices in a WLAN

开发者 https://www.devze.com 2023-04-09 05:09 出处:网络
In this question I asked how (programatically) was the best way to transfer data in the context referred in title - it was suggested connection through Sockets which I accepted, but now I have other p

In this question I asked how (programatically) was the best way to transfer data in the context referred in title - it was suggested connection through Sockets which I accepted, but now I have other problem (the reason why I'm creating another question)

The problem is, I did the Socket communication, but I faced the problem开发者_开发问答 of the open ports availability. The app I want to do meant to be independent of the Wireless Network - because it will be something I (the user) can't control - so it should work on most WLAN. So my questions are:

  • Connection through Sockets between two devices, always need open ports on the router/host? If yes, there's any efficient way to search through ports efficiently? If not:

  • There's any good alternative for connection through Wireless?

If not some of you of are probably thinking in Bluetooth connection but because in my app that requires that BT is always on (bidireccional communcation should be user "transparent" and will not always happen, also also want to convert my app to a service).

Guys, can you please give me some ideas?

I appreciate very much any help.


One of the basic functions of a router is to pass network traffic between connected devices. When sending data from between devices connected to the same router you don't need to worry about the router blocking traffic on specific ports, unless the router has been programmed to do so. However, most routers are not programmed to do this for internal traffic.

If you want to know if a port is available you can simply try to bind it. If the port is taken then you won't be able to bind it. Its that simple.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号