Contact us


All times are UTC - 8 hours



   [ 7 posts ] 
Author Message
   


Joined: Wed Jul 19, 2017 5:29 am
Posts: 4
Hi,

May I ask how to close the DWT ?

The scenario is: each time user click on "Scan", a new tab is displayed and user can select images to scan, the tab will be close automatically when scan is completed.

We use the following statements to load DWT when the tab is displayed:
----------------------------------
// this.id will increase each time
Dynamsoft.WebTwainEnv.Containers.push({ContainerId: "dwtcontrolContainer" + this.id, Width: "10", Height: "10"});
Dynamsoft.WebTwainEnv.Load();
Dynamsoft.WebTwainEnv.RegisterEvent("OnWebTwainReady", lang.hitch(this, this.onWebTwainReady));
-----------------------------------

And use the following to unload DWT when the tab is close:
-----------------------------------
Dynamsoft.WebTwainEnv.Unload();
-----------------------------------

However, I found that the "WebTWAINService.exe" process does not actually exit. Each time I open a "Scan" tab, the "Dynamsoft.WebTwainEnv.Containers.push({ContainerId: "dwtcontrolContainer" + this.id, Width: "10", Height: "10"});" will be executed one more time and a new "WebTWAINService.exe" process will be launched.

This results in a lot of "WebTWAINService.exe" processes and browser(e.g.:IE) is occupying more and more memory.

Am I using the right method to close and unload the DWT ? Could you give me any advice ?

Thank you in advance.

Li, Dong Rui


User avatar
   


Joined: Tue Mar 08, 2005 12:23 am
Posts: 1706
Hi Li,

Thanks for contacting Dynamsoft.

You are using the right method. Load() and Unload() methods are for initializing Dynamic Web TWAIN manually. However, there will be at least 2 processes running once Dynamsoft Service is up and running. Once there is 1 more object created, there will be 1 more process. If you need to close some of them, you can use CloseWorkingProcess.

Regards,

_________________
Vincy
Dynamsoft Support Team
Follow us@Twitter, Facebook


   


Joined: Wed Jul 19, 2017 5:29 am
Posts: 4
Hi Vincy,

Thank you for your reply. I have two environments, one is using DWT11.0, the other is using DWT12.0.

I notice that in the 'good' env which is using DWT v11.0

Dynamsoft.WebTwainEnv.Containers.push({ContainerId: "dwtcontrolContainer" + this.id, Width: "10", Height: "10"})

The "Containers" array contains 2 items, let's say their ContainerIds are:
dwtcontrolContainer0
dwtcontrolContainer1

However, after running "Dynamsoft.WebTwainEnv.Load();", the "Containers" array contains only 1 item, which is the latter one: dwtcontrolContainer1.

In the env that use DWT v12.0, the "Containers" array contains 2 items and after running the "Dynamsoft.WebTwainEnv.Load();", the "Containers" array is still 2 items. And with I scan one more time, the array contains one more item, hence the number of "WebTWAINService.exe" processes increases.

Is there any changes in the "Dynamsoft.WebTwainEnv.Load();" method between v11.0 and v12.0 ? How to prevent the number of "WebTWAINService.exe" processes from increasing ?

Thank you.

Li, Dong Rui


   


Joined: Wed Jul 19, 2017 5:29 am
Posts: 4
Hi Vincy,

I also tried to use CloseWorkingProcess to close the scanning process when scanning is complete, and the "WebTWAINService.exe" process is killed, this is good.

However, the websocket in IE does not seem to be released. After I scan 6 times, the number of websockets becomes 6 (By default, IE allows 6 concurrent websockets to one server). When I tried to scan the 7th time, IE does not allow to create new websocket, hence the connection to "WebTWAINService.exe" process failed and a message box appears, prompting me to download the DWT HTML5 Edition application.

When I use the dynamsoft.webtwain.initiate.js version 11.0, the above issue does NOT occur; the issue occurs when I use dynamsoft.webtwain.initiate.js 12.0.

Would you please give me some suggestions to solve it ?
Thank you.

Li, Dong Rui


User avatar
   


Joined: Tue Mar 08, 2005 12:23 am
Posts: 1706
Hi Li,

Sorry I didn't get the issue previously.

In v12.0, we introduced CreateDWTObject & DeleteDWTObject to do the job. Here is a guide for your reference.

Regarding the different behavior between v11.0 & v12.0. Could you double check if you are using the same code? I checked with my team and was confirmed we didn't change the logic for Load() method.

Please have a test and let me know how it works.

Regards,

_________________
Vincy
Dynamsoft Support Team
Follow us@Twitter, Facebook


   


Joined: Wed Jul 19, 2017 5:29 am
Posts: 4
Hi Vincy,

Thank you for your quick response.

From the guide, I notice that using the CreateDWTObject function needs to explicitly pass the ip, port and SSLPort parameters, is there any default value for these parameters ? Because in the old 'Load()' function, we do not need to care about the ip and port.

Thank you.

Li, Dong Rui


User avatar
   


Joined: Tue Mar 08, 2005 12:23 am
Posts: 1706
Hi Li,

CreateDWObject can also work with the id parameter only. If there is no IP specified, it will be 127.0.0.1 by default.

Regards,

_________________
Vincy
Dynamsoft Support Team
Follow us@Twitter, Facebook


Display posts from previous:  Sort by  
   [ 7 posts ] 


Who is online

Users browsing this forum: WillieCam and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
cron
Copyright © 2018 Dynamsoft | All Rights Reserved
dynamic designed by Dynamsoft team