MCPcopy Index your code
hub / github.com/Bitmessage/PyBitmessage / __init__

Method __init__

src/network/tcp.py:259–279  ·  view source on GitHub ↗
(self, host='127.0.0.1', port=8444)

Source from the content-addressed store, hash-verified

257
258class TCPServer(AdvancedDispatcher):
259 def __init__(self, host='127.0.0.1', port=8444):
260 if not hasattr(self, '_map'):
261 AdvancedDispatcher.__init__(self)
262 self.create_socket(socket.AF_INET, socket.SOCK_STREAM)
263 self.set_reuse_addr()
264 for attempt in range(50):
265 try:
266 if attempt > 0:
267 port = random.randint(32767, 65535)
268 self.bind((host, port))
269 except socket.error as e:
270 if e.errno in (asyncore.EADDRINUSE, asyncore.WSAEADDRINUSE):
271 continue
272 else:
273 if attempt > 0:
274 BMConfigParser().set("bitmessagesettings", "port", str(port))
275 BMConfigParser().save()
276 break
277 self.destination = state.Peer(host, port)
278 self.bound = True
279 self.listen(5)
280
281 def is_bound(self):
282 try:

Callers 3

__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45

Calls 7

BMConfigParserClass · 0.90
create_socketMethod · 0.80
set_reuse_addrMethod · 0.80
bindMethod · 0.80
setMethod · 0.80
listenMethod · 0.80
saveMethod · 0.45

Tested by

no test coverage detected