Fix invalid socket disconnect call in TcpClient
The testing main function now also stops the Client explicitly
This commit is contained in:
parent
83e22892ba
commit
0b2648bfe0
@ -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()
|
||||||
|
Loading…
Reference in New Issue
Block a user