+# FIXME: a less ugly way of passing all these options would be nice
+def connect_to_vend(options, DBServer, DBName, DBUser, DBPassword, ServiceName, ServicePassword):
+ # Open vending machine via LAT
+ if options.use_lat:
+ latclient = LATClient(service = ServiceName, password = ServicePassword)
+ rfh, wfh = latclient.get_fh()
+ else:
+ #(rfh, wfh) = popen2('../../virtualvend/vvend.py')
+ import socket
+ sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM, 0)
+ sock.connect((options.host, options.port))
+ rfh = sock.makefile('r')
+ wfh = sock.makefile('w')
+
+ return rfh, wfh
+