Skip to content

Commit edccc2a

Browse files
committed
Improve Linux/macOS compatibility on socket connect w/ empty hostname
1 parent 2226c4f commit edccc2a

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

server/enip/client.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,8 @@ def __init__( self, host, port=None, timeout=None, dialect=None, profiler=None,
422422
port = port_cnf # only override if nonexistent/None
423423
if port is None:
424424
port = defaults.address[1]
425-
self.addr = str( host ),int( port ) # host may be ip_address; str-ingify...
425+
# host may be ip_address; str-ingify, and Linux is strict vs. macOS; default to 'localhost'
426+
self.addr = str( host ) or 'localhost',int( port )
426427
self.addr_connected = not ( udp and broadcast )
427428
self.conn = None
428429
self.udp = udp

server/network.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ def thread_start( conn, addr ):
426426
log.debug( "TCP/IP: Idle Svc after {duration:7.3f}s".format( duration=duration ))
427427
idle_service()
428428
except KeyboardInterrupt as exc:
429-
log.warning( "%s server termination: %r", name, exc )
429+
log.info( "%s server termination: %r", name, exc )
430430
control['done'] = True
431431
except Exception as exc:
432432
log.warning( "%s server failure: %s\n%s", name,

0 commit comments

Comments
 (0)