简体   繁体   English

如何使用树莓派和 python 在互联网上创建聊天室

[英]How to create a chat room over internet with raspberry pi and python

I have a bit of an open ended questions for you all.我有一些开放式问题要问大家。 I wish to create a simple chat-room such as this example here: https://www.geeksforgeeks.org/simple-chat-room-using-python/ but I am lost as how to do it over the internet rather than just local network.我希望在这里创建一个简单的聊天室,例如此示例: https://www.geeksforgeeks.org/simple-chat-room-using-python/但我不知道如何通过互联网进行操作,而不仅仅是本地网络。

Any pointers/help would be appricated!任何指针/帮助都会被应用!

Thanks:)谢谢:)

There are multiple ways about this.对此有多种方法。 You can either:您可以:

  1. Run locally and expose your Python chat system to the internet.在本地运行并将您的 Python 聊天系统公开到 Internet。
  2. Run your Python chat system in some online server provider (Heroku, AWS, etc.).在某些在线服务器提供商(Heroku、AWS 等)中运行您的 Python 聊天系统。

The first method requires you to do some port-forwarding on your local network, essentially mapping your 127.0.0.1:8081 local server to your public IP (so you would connect via the internet as myip : 8081 ).第一种方法要求您在本地网络上进行一些端口转发,本质上是将您的127.0.0.1:8081本地服务器映射到您的公共 IP (因此您可以通过互联网连接为myip : 8081 )。 This method, however, comes with its limitations;然而,这种方法有其局限性。 when you turn off your computer you are also effectively turning off your server to the rest of the internet.当您关闭计算机时,您实际上也关闭了连接到 Internet 的 rest 的服务器。 The second method will ensure the server stays on at all times, and is likely what you are looking for.第二种方法将确保服务器始终保持打开状态,并且可能是您正在寻找的。 Heroku is a great starting point as they provide a free tier that you can test everything out. Heroku是一个很好的起点,因为它们提供了一个免费层,您可以测试一切。

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

相关问题 适用于Raspberry Pi的Python检查Internet连接 - Python Check for Internet Connection working with Raspberry Pi Raspberry pi和其他计算机之间通过python实时通过Internet进行远程连接 - Remote connection between Raspberry pi and other computer through python over internet on real time 树莓派,Python:如何通过 usb 串口发送大数据? - Raspberry Pi, Python: How to send large data over usb serial? 如何通过互联网而不是局域网连接到我的树莓派? - How to connect to my Raspberry Pi over the internet, rather than inside the LAN? 在覆盆子pi的wifi上的Python插座 - Python Socket over wifi in raspberry pi 如何在树莓派中更新 python - how to update python in raspberry pi 如何使用 Python REST API 在 openfire 中创建聊天室并将用户添加到房间 - How to create a chat room and add users into the room in openfire using Python REST API 如何在没有互联网连接的情况下在raspberry pi中安装python库? - How do I install python libraries in raspberry pi without an internet connection? Python Raspberry Pi在Kivy中创建栏 - Python Raspberry Pi Create bars in Kivy 创建文本文件Python无法正常工作-Raspberry Pi - Create text file Python not working - Raspberry Pi
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM