src/eric7/RemoteServerInterface/EricServerInterface.py

branch
eric7
changeset 10958
79842be466d3
parent 10949
2057b1b198a5
child 11004
5f8d929657b3
equal deleted inserted replaced
10957:fbd61fd3fdc1 10958:79842be466d3
295 """ 295 """
296 if self.isServerConnected(): 296 if self.isServerConnected():
297 return self.__connection.peerName() 297 return self.__connection.peerName()
298 else: 298 else:
299 return "" 299 return ""
300
301 def parseHost(self, host):
302 """
303 Public method to parse a host string generated with 'getHost()'.
304
305 @param host host string
306 @type str
307 @return tuple containing the host name and the port
308 @rtype tuple of (str, int)
309 """
310 host = host.strip()
311 if "]" in host:
312 # IPv6 address
313 hostname, rest = host.split("]")
314 hostname = hostname[1:]
315 if rest and rest[0] == ":":
316 port = int(rest[1:])
317 else:
318 port = None
319 else:
320 if ":" in host:
321 hostname, port = host.split(":")
322 port = int(port)
323 else:
324 hostname = host
325 port = None
326
327 return hostname, port
300 328
301 ####################################################################### 329 #######################################################################
302 ## Methods for sending requests and receiving the replies. 330 ## Methods for sending requests and receiving the replies.
303 ####################################################################### 331 #######################################################################
304 332

eric ide

mercurial