![](/img/trans.png)
[英]“ sock, addr = self._sock.accept() socket.error: [Errno 95] Operation not supported ”
[英]socket.error: [Errno 102] Operation not supported on socket
我在Mac上使用Python。
但是下面的代碼
import socket
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.bind(('127.0.0.1', 443))
s.listen(2048)
遇到問題
Traceback (most recent call last):
File "attacker.py", line 5, in <module>
s.listen(2048)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py", line 228, in meth
return getattr(self._sock,name)(*args)
socket.error: [Errno 102] Operation not supported on socket
如何解決這個問題?
您正在使用udp套接字,SOCK_DGRAM,並且udp不偵聽連接,它會自己接收每條消息使用recvfrom來接收udp消息
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.