Move listening socket initialization methods to __init__()
This commit is contained in:
parent
58d9c9afe2
commit
e7dcec142a
|
@ -16,10 +16,10 @@ class Listener(threading.Thread):
|
||||||
self.s = socket.socket(self.family, socket.SOCK_STREAM)
|
self.s = socket.socket(self.family, socket.SOCK_STREAM)
|
||||||
self.s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
|
self.s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
|
||||||
self.s.bind((self.host, self.port))
|
self.s.bind((self.host, self.port))
|
||||||
|
|
||||||
def run(self):
|
|
||||||
self.s.listen(1)
|
self.s.listen(1)
|
||||||
self.s.settimeout(1)
|
self.s.settimeout(1)
|
||||||
|
|
||||||
|
def run(self):
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
conn, addr = self.s.accept()
|
conn, addr = self.s.accept()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user