简体   繁体   English

通过互联网与Android手机和PC进行双向通信

[英]2 Way Communication with Android Phone and PC via Internet

I am trying to control a Remote Control Car with an Andriod Phone from my PC (over 3g internet) 我试图用我的电脑上的Andriod手机控制遥控车(超过3G网络)

I'm planning on using a ioio (Which is just a board that I can plug into a andriod phone via USB) 我打算使用ioio(这只是我可以通过USB插入手机的电路板)

The part I am working on now is the communication from my PC to my Andriod App. 我现在正在处理的部分是从我的PC到我的Andriod App的通信。 I've never made Andriod apps before and I'm a amateur C# developer. 我之前从未制作过Andriod应用程序,而且我是业余的C#开发人员。

At the moment I am planning on communicating via UDP as I can create a UDP server/client in Java easy enough. 目前我正在计划通过UDP进行通信,因为我可以很容易地用Java创建UDP服务器/客户端。 (http://systembash.com/content/a-simple-java-udp-server-and-udp-client/) (http://systembash.com/content/a-simple-java-udp-server-and-udp-client/)

However I think this may require a public IP address? 但是我认为这可能需要一个公共IP地址? Which I will not have either on my client or server. 我在客户端或服务器上都没有。

So for simplicty sake, How would you commucicate over the internet between 2 JAVA applications. 因此,为了简单起见,您将如何在2个JAVA应用程序之间通过互联网进行通信。 If you need to stream video from a camera and simple commands. 如果您需要从摄像头流式传输视频和简单的命令。

You don't necessarily need a public IP, you just need some sort of IP with which one device can send packets to the other. 你不一定需要一个公网IP,你只需要某种形式的IP与一个设备可以发送数据包到其他。 For example, you could connect the phone to your home wifi network, and use the private IPs (typically 192.168.1.x) of the two devices. 例如,您可以将手机连接到家庭wifi网络,并使用两个设备的专用IP(通常为192.168.1.x)。

If you need the phone to be on 3G, and your PC is behind a NAT router (which is typical), then you'll need to forward a port to your PC — this is a configuration setting on the router — and then have the phone connect to that port on your router's public IP. 如果您需要将手机放在3G上,并且您的PC位于NAT路由器(这是典型的)后面,那么您需要将端口转发到您的PC - 这是路由器上的配置设置 - 然后拥有手机连接到路由器公共IP上的那个端口。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM