Schoeni, Yann wrote: > > > I thought it would be a great idea to keep it open during the > application life time for one reason. > > > > My webserver (running on windows) got a Velleman VM8090 module plugged > in with a usb cable, my serial port is virtual. > > > > 7) Sometimes, the script return « The Serial port is already > open », and a *delay is identified*. Below the function that open the > port : > > 8) Because of this delay I was just thinking about keeping the > serial port open while the application is running. > > > > What do you guys think ? $ >
There are two possible solutions. The only time the port should be open is if you are already processing another request. No matter what you do, there's always going to be a delay in that case. Your problem, then, is to serialize access to the serial port, to ensure there's only one request at a time. Your proposed solution is certainly workable. You could create a long-running "serial server" that keeps the serial port open and accepts requests from your web server. The other solution is to change your script so that IT keeps retrying until it's able to open the port, with a short delay between each attempt. That way, the web server would always see success. The delay with the two solutions should be about the same; you're always going to have to wait for request A to finish before request B starts, but the second solution would be easier, from where you are now. -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc. _______________________________________________ python-win32 mailing list python-win32@python.org https://mail.python.org/mailman/listinfo/python-win32