不支持python套接字协议

2024-07-05 12:21:28 发布

您现在位置:Python中文网/ 问答频道 /正文

我在RaspberryPi3上使用了python can isotp,并用示例代码对其进行了测试,但是我得到了一个错误。在

我的简单代码:

import isotp

s = isotp.socket()
s2 = isotp.socket()
# Configuring the sockets.
s.set_fc_opts(stmin=5, bs=10)
#s.set_general_opts(...)
#s.set_ll_opts(...)

s.bind("vcan0" rxid=0x123 txid=0x456)  # We love named parameters!
s2.bind("vcan0", rxid=0x456, txid=0x123)
s2.send(b"Hello, this is a long payload sent in small chunks of 8 bytes.")
print(s.recv())

错误:

File "/usr/local/opt/python-3.7.0/lib/python3.7/socket.py", line 151, in __init__ _socket.socket.__init__(self, family, type, proto, fileno) OSError: [Errno 93] Protocol not supported

有人能帮我找到解决问题的办法吗?在


Tags: 代码ininitbind错误socketcanset
1条回答
网友
1楼 · 发布于 2024-07-05 12:21:28

我遵循这些instructions(稍作修改)使isotp使用最新的Raspbian拉伸处理树莓pi3b+。在

以下是我执行命令的确切顺序:

sudo apt update
sudo apt upgrade
git clone https://github.com/hartkopp/can-isotp.git
cd can-isotp
sudo apt install build-essential raspberrypi-kernel-headers
make install
sudo make modules_install
modprobe can
sudo insmod ./net/can/can-isotp.ko

但是,我在Python中没有使用它。我只是测试了提供给isotp使用的工具,例如isotpsend和{}。在

相关问题 更多 >