comparison scpisock.py @ 28:c6be52360c2f

Handle default port better so passing None in picks the default.
author Daniel O'Connor <darius@dons.net.au>
date Wed, 21 Sep 2011 14:56:55 +0930
parents ef713fe03db8
children b6ebe05f250f
comparison
equal deleted inserted replaced
27:e2833d081413 28:c6be52360c2f
34 # ToDo: Implement the SRQ & DCL channel (I don't have any supported hardware) 34 # ToDo: Implement the SRQ & DCL channel (I don't have any supported hardware)
35 35
36 SCPI_PORT = 5025 36 SCPI_PORT = 5025
37 37
38 class SCPISockDevice(object): 38 class SCPISockDevice(object):
39 def __init__(self, host, port = SCPI_PORT): 39 def __init__(self, host, port = None):
40 if port == None:
41 port = SCPI_PORT
40 self.sock = socket.create_connection((host, port)) 42 self.sock = socket.create_connection((host, port))
41 43
42 def flush(self): 44 def flush(self):
43 while True: 45 while True:
44 r, w, x = select.select([self.sock], [], [], 0) 46 r, w, x = select.select([self.sock], [], [], 0)