sajith
sajith

Reputation: 2702

Is there an API in Java program for wifi connectivity and data transfer?

I am developing an application which runs on a desktop or laptop having wifi. In my application I want to connect my desktop and multiple android device through wifi, and I need to transfer data between them.

How can I do this? Is there an API for wifi in Java SE? How can I connect to different devices through wifi?

Upvotes: 2

Views: 4393

Answers (2)

Nick Holt
Nick Holt

Reputation: 34301

First off, you're confusing the network stack or what I originally learn as the 7 layer OSI model. The wifi connection is down in layer one and typically when you're writing software you don't go anywhere near this layer.

Software usually connects at levels 5 and above. The java.io package provides the classes needed to do this, leaving you to decide whether to work with a direct socket connection or use on of the protocols in the higher levels such as http.

My advice would be to use http as your protocol with Tomcat or similar as your server, putting the logic you need in servlets or JSPs as appropriate. Sending http requests from Andriod is explained here.

Upvotes: 1

Kennet
Kennet

Reputation: 5796

You don't have to bother how the network connection is established in the operating system. Open a connection and that's it.

Upvotes: 3

Related Questions