|
25 | 25 | # from Pyro4.futures import Future
|
26 | 26 |
|
27 | 27 | import sys
|
| 28 | +import ipaddress |
| 29 | + |
28 | 30 | from .. import api
|
29 | 31 | from .. import errors
|
30 | 32 | from .. import serializers
|
@@ -141,25 +143,25 @@ def excepthook(self, *args, **kwargs):
|
141 | 143 | class SocketUtilModule:
|
142 | 144 | @staticmethod
|
143 | 145 | def getIpVersion(hostnameOrAddress):
|
144 |
| - return socketutil_pyro5.get_ip_version(hostnameOrAddress) |
| 146 | + return ipaddress.ip_address(hostnameOrAddress).version |
145 | 147 |
|
146 | 148 | @staticmethod
|
147 | 149 | def getIpAddress(hostname, workaround127=False, ipVersion=None):
|
148 |
| - return socketutil_pyro5.get_ip_address(hostname, workaround127, ipVersion) |
| 150 | + return str(socketutil_pyro5.get_ip_address(hostname, workaround127, ipVersion)) |
149 | 151 |
|
150 | 152 | @staticmethod
|
151 | 153 | def getInterfaceAddress(ip_address):
|
152 |
| - return socketutil_pyro5.get_interface_address(ip_address) |
| 154 | + return str(socketutil_pyro5.get_interface(ip_address).ip) |
153 | 155 |
|
154 | 156 | @staticmethod
|
155 | 157 | def createSocket(bind=None, connect=None, reuseaddr=False, keepalive=True,
|
156 |
| - timeout=socketutil_pyro5._GLOBAL_DEFAULT_TIMEOUT, noinherit=False, |
| 158 | + timeout=-1, noinherit=False, |
157 | 159 | ipv6=False, nodelay=True, sslContext=None):
|
158 | 160 | return socketutil_pyro5.create_socket(bind, connect, reuseaddr, keepalive,
|
159 | 161 | timeout, noinherit, ipv6, nodelay, sslContext)
|
160 | 162 |
|
161 | 163 | @staticmethod
|
162 |
| - def createBroadcastSocket(bind=None, reuseaddr=False, timeout=socketutil_pyro5._GLOBAL_DEFAULT_TIMEOUT, ipv6=False): |
| 164 | + def createBroadcastSocket(bind=None, reuseaddr=False, timeout=-1, ipv6=False): |
163 | 165 | return socketutil_pyro5.create_bc_socket(bind, reuseaddr, timeout, ipv6)
|
164 | 166 |
|
165 | 167 | @staticmethod
|
|
0 commit comments