如何通过wifi设置PC和android设备之间的连接 [英] how to setup connection between PC and android devices through wifi

查看:359
本文介绍了如何通过wifi设置PC和android设备之间的连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发可在我的电脑上运行的android应用程序,并通过wify连接到不同的android设备并与之通信,为此我如何设置wifi连接,是否有可能通过wifi将更多设备连接到我的pc,我需要在ubutu11.10或Windows 7中设置连接

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

推荐答案

您的问题含糊不清,并且有很多可能的正确"答案.首先,整个wifi与互联网部分无关紧要,您只想通过网络将Android设备与PC进行通信.

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.

要查找的术语是sockets.您要做的是侦听PC(服务器")上的特定端口.您必须打开防火墙中的相关端口.

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.

然后,您编写一个与此服务器通信的android应用,请参见此处进行适当的介绍.

You then write an android app that communicates with this server, see here for a proper introduction.

使用单个套接字(IP地址+端口)连接多个设备没有任何问题,只要您的协议包括每个客户端标识自己的方式即可.

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.

...

也就是说,您还可以在更高级别上运行基于SOAP/JSON的客户端/服务器方案(与编写自己的基于套接字的协议相对)来完成所有这些工作.请参阅 http://wiebe-elsinga.com/blog/?p=405 一个例子.

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.

这篇关于如何通过wifi设置PC和android设备之间的连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆