Skip to content

Crashes on client connection: io.UnsupportedOperation: fileno #6

@sigurdo

Description

@sigurdo

Python version: 3.10.11

I am currently trying to use ser2tcp to forward a COM port on Windows to WSL2 over TCP, but the connection crashes with the following error as soon as I connect the client:

ser2tcp.exe -c .\ser2tcp_config.json
Traceback (most recent call last):
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:\Users\sigur\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\Scripts\ser2tcp.exe\__main__.py", line 7, in <module>
  File "C:\Users\sigur\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\ser2tcp\main.py", line 53, in main
    servers_manager.process()
  File "C:\Users\sigur\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\ser2tcp\server_manager.py", line 20, in process
    read_sockets = _select.select(sockets, [], [], .1)[0]
io.UnsupportedOperation: fileno

Here is my config:

[
    {
        "serial": {
            "port": "COM7",
            "baudrate": 57600,
            "parity": "NONE",
            "stopbits": "ONE"
        },
        "servers": [
            {
                "address": "127.0.0.1",
                "port": 10001,
                "protocol": "TCP"
            },
            {
                "address": "0.0.0.0",
                "port": 10002,
                "protocol": "TELNET"
            },
            {
                "address": "172.29.176.1",
                "port": 10003,
                "protocol": "TCP"
            }
        ]
    }
]

172.29.176.1 is the IP address of Windows on the Windows-WSL2 ethernet adapter.

On the WSL side I use socat to forward TCP to a virtual COM port with the following command:

sudo socat  pty,link=/dev/virtualcom0,raw  tcp:172.29.176.1:10003

socat returns with no error message and no error code. I know nothing about socat, just copied the command from this stackoverflow post, so I might very well be using it wrong. Does anyone know what I might be doing wrong, or if there could be a bug in ser2tcp?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions