Fix invalid socket disconnect call in TcpClient

The testing main function now also stops the Client explicitly
This commit is contained in:
maranov 2021-06-21 17:25:09 +02:00 committed by Novak, Marek
parent 83e22892ba
commit 0b2648bfe0

View File

@ -32,7 +32,7 @@ class TcpClient(object):
self.socket.connect("tcp://%s:%s" % (self.host, self.port)) self.socket.connect("tcp://%s:%s" % (self.host, self.port))
def stop(self): def stop(self):
self.socket.disconnect() self.socket.close()
def read_raw_buffer(self): def read_raw_buffer(self):
""" Read raw ADS-B data type. """ Read raw ADS-B data type.
@ -292,4 +292,7 @@ if __name__ == "__main__":
port = int(sys.argv[2]) port = int(sys.argv[2])
datatype = sys.argv[3] datatype = sys.argv[3]
client = TcpClient(host=host, port=port, datatype=datatype) client = TcpClient(host=host, port=port, datatype=datatype)
try:
client.run() client.run()
finally:
client.stop()