My project was to create an application like AirDrop of Apple. To do so, I need to create an specific network for my application so that only my application can pick this network and I have to do it with Java. To my knowledge, Java does not have a wifi library. So what is my option here for my project?

I cannot use Ethernet connection. I have to use a network something like bluetooth which will find only the existing application in the network.

I am sorry if I missed anything. I am not too good with networking as well.

有帮助吗?

解决方案

AirDrop for Mac OS X basically uses mDNS to discover other computers on the same network that also have AirDrop running, then uses regular TCP/IP connections to transfer the files. This means you don't have to create "a specific network for your application".

There's an mDNS library for Java called JmDNS.

For general information about networking in Java, I recommend this trail from the Oracle Java Tutorial (the All About Sockets section to be more specific).

Also note that AirDrop for iOS uses a different method involving Bluetooth and WiFi, which is different from AirDrop for Mac OS X.

Addendum: Looks like AirDrop also uses some WiFi-chipset-specific features to create an Ad-Hoc network simultaneously with the current network connection. Creating Ad-Hoc networks is dependent on the operating system and is really out of the scope of a Java program. See also: this, this and this.

However, this shouldn't stop you from trying the mDNS approach, as long as the computers are connected to the same network.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top