Open mixc0lumn opened 9 months ago
The order was intentional - I can't think of a good reason for a user to want to deal with timeouts on first connect, and I would imagine that many ECU's have trouble with the initial connection as there's more packets back/forth and setup. The OS will still have a timeout in the overall TCP layer as well as any timeouts with IP resolution, etc. I would accept a patch to allow the client constructor to accept an optional connect_timeout if you have a use case for it though.
Thanks, the patch is useful for us if allowed. We need to deal with so many ECUs with uncertain state (connected or not). The only possible way is to send a doip package to the specific logical address and observe the response. The default timeout will be too long to accept if the timeouts on first connect is not optional in doipclient : )
In _connect function of client.py,
self._tcp_sock.settimeout(A_PROCESSING_TIME)
is set afterself._tcp_sock.connect((self._ecu_ip_address, self._tcp_port))
, which make A_PROCESSING_TIME is not effective. Below is the fix suggestion, where the position of these two lines change: