[英]How to make python server public to other computers in a Linux machine?
I have an ubuntu computer and I want it to act as a server.我有一台 ubuntu 计算机,我希望它充当服务器。 How do I need to configure the ubuntu computer to be accessible from other computers?
如何将 ubuntu 计算机配置为可从其他计算机访问? Let's say I have this very simple python
TCP
server:假设我有这个非常简单的 python
TCP
服务器:
from socket import socket
with socket() as server:
server.bind(("", 5555))
server.listen(5)
print("[+] Server Listening")
client, addr = server.accept()
print(f"client connected from address {addr}")
How can I make this server public to other computers to connect?如何将此服务器公开给其他计算机以进行连接?
Well making a server publicly available is something that we need to know more details about your project.好吧,让服务器公开可用是我们需要了解有关您项目的更多详细信息的事情。 What do you mean about public??
公众号是什么意思?? Do you want your server to be publicly available to internet??
你想让你的服务器对互联网公开吗? Or you just want to use it in your local LAN????
或者你只是想在你的本地局域网中使用它????
One way you can expose your local service publicly is by using some kind of application like localtunnel
or ngrok
公开本地服务的一种方法是使用某种应用程序,例如
localtunnel
或ngrok
Example with ngrok: ngrok http 5555 ngrok 示例:ngrok http 5555
Example with localtunnel: lt --port 5555 localtunnel 示例:lt --port 5555
These applications will open a tunnel on a random port locally and forward all the connections it gets on the application generated URL to the port you have specified.这些应用程序将在本地随机端口上打开一个隧道,并将它在应用程序生成的 URL 上获得的所有连接转发到您指定的端口。
Do not use these for production.不要将这些用于生产。 Not very reliable approach
不是很可靠的方法
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.