Merge pull request #111 from maranov/bugfix/tcpclient_disconnect

Fix invalid socket disconnect call in TcpClient
This commit is contained in:
Junzi Sun 2021-07-07 22:46:21 +02:00 committed by GitHub
commit 01574a9f01
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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)
client.run() try:
client.run()
finally:
client.stop()