I'm working on communicating data to a Diagraph IJ4000 packaging line printer. Right now I've settled on using system.net.httpClient() to send the data. The scripting is very basic, as the printer has built-in cgi scripts where all I'm doing is sending a GET and the URL that includes the target cgi and any data parameters.
My Project script looks as such:
# Create the JythonHttpClient.
client = system.net.httpClient()
def loadDiagraph(ipAddress,printTemplate,lotNumber,mfgDate,expireDate):
#Send Data & Start Print requst
client.get("http://"+ipAddress+"/serial.cgi?idx=0&nme="+printTemplate+"&fst=1&lst=3&d1="+lotNumber+"&d2="+mfgDate+"&d3="+expireDate+"&net=1")
I'm then calling the script from inside a "Load Printer" button I've placed on a screen.
This works without fault, but I've read through multiple forum threads about being careful with calling the system.net.httpClient() too much or in specific scenarios - most of which is beyond my current knowledge and I'm not understanding.
Right now we're testing a single printer, but I could end up with as many as 6-7 line printers which I'll need to send data to in this manner.
Is there a way to see if I've opened too many connections? Do I need to close the connection(s) somehow after sending the data? If so, how?
Thank you for any assistance!