如何解决Python Sockets/SocketServer连接[Errno 10048]& [错误号10049]?
我正在尝试制作一款在线 FPS 游戏,到目前为止它可以在我的本地网络上运行。我想做的是让它在全球范围内工作
我过去曾尝试过让其他Python项目在全球范围内工作,但到目前为止我还无法让它工作。我从 ipchicken 或其他什么地方获取我的 IP,并将其作为服务器的主机,但是当我尝试启动它时,我得到了这个。
socket.error: [Errno 10049] The requested address is not valid in its context
我已经尝试了从不同地方找到的可能是我的 IP 地址的许多不同版本,但它们都给出了该输出。
我想,既然我有了自己的网络空间,我就可以尝试做 Python 手册中所说的事情:
其中 host 是一个字符串,表示采用 Internet 域表示法(如“daring.cwi.nl”)的主机名
因此,我输入了我的网络空间的域 (h4rtland.p3dp.com
),然后收到此错误:
socket.error: [Errno 10048] Only one usage of each socket address (protocol/network address/port) is normally permitted
虽然只在端口 80 上,但其他任何东西都会给我带来与以前相同的错误。
如果有人能为我阐明这个主题,我将不胜感激。
I'm trying to make an online FPS game and so far it works on my local network. What I'm trying to do is make it work globally
I've tried making other Python projects work globally in the past but so far I haven't been able to get it to work. I get my IP from ipchicken or whatever and put it as the HOST for the server, but when I try to start it I get this.
socket.error: [Errno 10049] The requested address is not valid in its context
I've tried many different versions of what could be my IP address found from various different places, but all of them give that output.
I thought, since I had my webspace, I could try doing what it says you can do in the Python manual:
where host is a string representing either a hostname in Internet domain notation like 'daring.cwi.nl'
So, I put in the domain of my webspace (h4rtland.p3dp.com
) and I get this error:
socket.error: [Errno 10048] Only one usage of each socket address (protocol/network address/port) is normally permitted
Though only on port 80, anything else gives me the same error as before.
If anybody can shed some light on this subject for me it would be greatly appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
首先,端口 80 通常是 http 流量。端口 5000 下的任何内容都是特权的,这意味着您确实不想将服务器分配给此端口,除非您绝对知道自己在做什么...以下是设置服务器套接字的简单方法接受监听...
这是一个 TCP 连接,对于 FPS 游戏,您可能希望使用 UDP 来研究,这样丢弃的数据包不会严重影响性能...祝你好运
First off, port 80 is typically http traffic. Anything under port 5000 is priviledged which means you really don't want to assign your server to this port unless you absolutely know what you are doing... Following is a simple way to set up a server socket to accept listen...
This is a TCP connection, for an FPS game you likely want to look into using UDP such that dropped packets don't impact performance terribly... Goodluck