我们可以连接到不同网络上的套接字服务器吗?

发布于 2025-01-20 17:18:39 字数 298 浏览 1 评论 0原文

对不起,我是这里建立网络的初学者。

我正在尝试连接到我朋友的网络。她距离我约10公里。我是客户端,她是我要连接并发送消息的服务器。

我试图在自己的LAN上连接两台计算机。它奏效了!当然,不同的IP。它不再起作用了!

我的问题是:

  • 是否可以使用Python套接字模块连接到不同Internet提供商或网络上的一台或多台远程计算机?
  • 是否可以使用Python套接字模块在WiFi LAN上的计算机和WiFi移动热点上的计算机上接收并发送消息?
  • 我可能需要建立什么连接?

Excuse me, I am a beginner to networking here.

I am trying to connect to my friend's network. She is approximately 10 kilometers from me. I am the client and she is the server that I want to connect and send messages.

I tried to connect two computers on my own LAN. It worked!, but when I change internet of another laptop to mobile hotspot and try to connect to that laptop. Of course, different IP. It doesn't work anymore!

My questions are:

  • Is it possible to connect to one or more remote computers that are on the different internet provider or network using python socket module?
  • Is it possible to receive and send messages between a computer on WIFI LAN and a computer on WIFI mobile hotspot using python socket module?
  • What do I probably need to make the connection?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

情场扛把子 2025-01-27 17:18:39
  • 是的。
  • 是的。
  • 确保您朋友的服务器具有可路由的IP地址。

如果您的客户试图连接
跨越公共互联网
到rfc1918 私人地址
它将以您报告的方式失败。
您需要确保客户是
连接到可及服务器IP。
它必须是可路由的,
两者之间一定不能有防火墙
哪个过滤并丢弃您的数据包。

  • Yes.
  • Yes.
  • Ensure that your friend's server has a routable IP address.

If your client is attempting to connect
across the public internet
to an rfc1918 private address,
it will fail in the way you reported.
You need to ensure the client is
connecting to a reachable server IP.
It must be routable,
and there must not be a firewall in between
which filters and discards your packets.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文