nimbuscontrols / EIPScanner

Free implementation of EtherNet/IP in C++
https://eipscanner.readthedocs.io/en/latest/
MIT License
224 stars 90 forks source link

Close socket when TCPSocket constructor throws #74

Closed ctucker-sri closed 1 year ago

ctucker-sri commented 2 years ago

Connection failure and timeout in TCPSocket constructor leaves socket file descriptor open when it throws.

Adds code to catch errors in TCPSocket constructor; close socket; and re-throw.

Saw this failure on Linux with code that was retrying a connection. Linux eventually runs out of file descriptors.

manter-international commented 1 year ago

Thanks for the fix.