简体   繁体   English

Raspberry Pi 2 和 PC 之间通过互联网进行通信

[英]Communication between Raspberry Pi 2 and a PC via internet

My issue is that I am trying to run a java code on my Raspberry Pi 2 that display text based on command sent from my PC (which is not in local network, or physically connected with the Raspberry Pi 2).我的问题是我试图在我的 Raspberry Pi 2 上运行一个 Java 代码,该代码根据从我的 PC(不在本地网络中,或与 Raspberry Pi 2 物理连接)发送的命令显示文本。 My problem is that I did not even know where to start from!我的问题是我什至不知道从哪里开始!

My current attempt:我目前的尝试:

My initial idea was that I would manage to send the text to a website or via Dropbox and then it would be simple for the Raspberry Pi 2 to read this text using a simple Java code.我最初的想法是,我将设法将文本发送到网站或通过 Dropbox,然后使用简单的 Java 代码让 Raspberry Pi 2 读取文本变得简单。 The issue was that setting up Dropbox seems like an overkill since it is just a simple text that I want to transfer.问题是设置 Dropbox 似乎有点矫枉过正,因为它只是我想要传输的简单文本。 As for reading texts from website I got stuck on how on earth can I create a dummy website where I can simply update its text content using Java code or any other program without actually opening the website or using my PC as a server.至于从网站上阅读文本,我被困在到底如何创建一个虚拟网站,在那里我可以使用 Java 代码或任何其他程序简单地更新其文本内容,而无需实际打开网站或使用我的 PC 作为服务器。

If I am overthinking and there is a simpler solution it is definitely welcomed and appreciated :)如果我想得太多并且有一个更简单的解决方案,它绝对受到欢迎和赞赏:)

your solution is fine, i'd suggest to go with something like github or gist (something [only] you can edit).您的解决方案很好,我建议您使用 github 或 gist 之类的东西([仅] 您可以编辑的东西)。

best solution would be if you had a webservice running on your raspberry pi, so you can send commands to it via webservice calls.最好的解决方案是,如果您在 raspberry pi 上运行了一个网络服务,那么您可以通过网络服务调用向它发送命令。 (google for spring-boot simple rest service) (google for spring-boot simple rest service)

eg: see --> here例如:见-->这里

another option would be to have FTP running on your PI and sending the commands to a text-file on your pi via FTP.另一种选择是让 FTP 在您的 PI 上运行,并通过 FTP 将命令发送到您的 pi 上的文本文件。

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

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