问题
i am developing android application which runs in my pc and connects to different android devices through wify and communicate with them,how i setup wifi connection for this purpose,is it possible to connect more devices to my pc through wifi,I need to setup connection in ubutu11.10 or windows 7
回答1:
Your question is vague and open to a lot of potentially "correct" answers. First of all, the whole wifi v.s. internet part is irrelevant, you just want to communicate from your Android devices to your pc over the network.
The term to look for is sockets
. What you do is listen to particular port on the PC (the "server"). You'll have to open up the relevant ports in the firewall.
You then write an android app that communicates with this server, see here for a proper introduction.
There is no problem using a single socket (ip address + port) to connect with multiple devices, as long as your protocol includes a way for each client to identify itself.
...
That said, you can also do all of this at a higher level, running a SOAP/JSON-based client/server scheme (as opposed to writing your own socket-based protocol). See http://wiebe-elsinga.com/blog/?p=405 for an example.
What is the most appropriate choice depends on your exact requirements (performance, deployment) and your level of experience.
回答2:
If you are looking at establishing an ADB connection to a device try ADB wireless http://www.helloandroid.com/content/connect-your-android-phone-adb-wireless
You will need to root your device for this to work
来源:https://stackoverflow.com/questions/9548539/how-to-setup-connection-between-pc-and-android-devices-through-wifi