hardbyte / hardbyte/python-can
Socketcand UNIX Socket Support
- 主要語言
- Python
- 星號
- 1.6k
- 分支
- 697
- PR 合併指標
- 30 天內沒有已合併 PR
描述
### Is your feature request related to a problem? Please describe.
I am working with CAN bus in Docker containers. I personally find it more reliable to pass a UNIX socket path from the host to a container than it is to use `host.containers.internal` or whatever they call it these days. Socketcand natively supports binding to a UNIX socket, but there is no API to connect to it via python-can.
### Describe the solution you'd like
An additional argument to `SocketCanDaemonBus` that allows specifying a socket path. When passed, it should allow for the host and port to be empty, and should change `socket.AF_INET` to `socket.AF_UNIX` on [this line](https://github.com/hardbyte/python-can/blob/b57bc514a64e61ff1579a7d456310ef2bc30c80d/can/interfaces/socketcand/socketcand.py#L47). The socket path should be passed to `socket.connect()` without the port.
### Describe alternatives you've considered
I have tried long and hard to get communication working via standard TCP/IP but it just seems to hate me. This seems like the next best option, and I think it should be supported since it's a core feature of Socketcand :)
貢獻指南
研究方向
Start in can/interfaces/socketcand/socketcand.py at SocketCanDaemonBus and inspect the existing socket setup around line 47. Add support for an optional UNIX socket path while retaining the host/port behavior; done when the bus can connect using the path without requiring host or port.
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- python
- 領域
- networking
- Issue 類型
- 功能
- 難度
- 2/5
- 預估耗時
- 1-3 小時
- 活躍度
- 停滯
- 描述清晰度
- 描述清楚
- 新手友好度
- 58/100