Creating file in watch directory

This forum is for general support of Xbase++
Message
Author
Cliff Wiernik
Posts: 605
Joined: Thu Jan 28, 2010 9:11 pm
Location: Steven Point, Wisconsin USA
Contact:

Creating file in watch directory

#1 Post by Cliff Wiernik »

We have a program that monitors a watch folder for a file with information needed to pull an individual's credit report.

We currently create the comma delimited information in a string and use memowrit to create the file in the watch folder.

We had an instance where there appears to be some type of contention between the third party program and our software. We had an instance where the export file did not get created. I think the 3rd party program intercepted the file after it was created but prior to the data being added to the file. Thus our program could not create the file. Nothing was processed.

I was inquiring as to some other way of getting the file into the watch folder instead of directly creating via memowrite. May be using the low level file process with exclusive access, but that appears to only be a function of the fopen() process, not the fcreate process. I could make the file hidden then change the attribute. Has anyone had any experience with similar watch folder processes and contention and any recommendations.

Cliff

bwolfsohn
Posts: 648
Joined: Thu Jan 28, 2010 7:07 am
Location: Alachua, Florida USA
Contact:

Re: Creating file in watch directory

#2 Post by bwolfsohn »

Cliff,

are you creating a file with a specific name ?

that could be the problem...

create a file with a random name.csv
then
monitor the directory for *.csv
Brian Wolfsohn
Retired and traveling around the country to music festivals in my RV.
OOPS.. Corona Virus, so NOT traveling right now...
http://www.breadmanrises.com
FB travel group: The Breadman Rises

User avatar
Auge_Ohr
Posts: 1406
Joined: Wed Feb 24, 2010 3:44 pm

Re: Creating file in watch directory

#3 Post by Auge_Ohr »

Cliff Wiernik wrote:We have a program that monitors a watch folder for a file with information needed to pull an individual's credit report.
i guess you use a M$ Server ... which Version ?
it seem to me you got SMB2 Directory Problem ... look here
https://technet.microsoft.com/en-us/lib ... 10%29.aspx

"bad" Workaround : use Alaska SMB2 "Hotfix"
"good" Workaround : https://msdn.microsoft.com/en-us/librar ... 85%29.aspx
greetings by OHR
Jimmy

User avatar
rdonnay
Site Admin
Posts: 4728
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: Creating file in watch directory

#4 Post by rdonnay »

Are you saying that the 3rdparty program is looking for a file with a specified name?
The eXpress train is coming - and it has more cars.

Cliff Wiernik
Posts: 605
Joined: Thu Jan 28, 2010 9:11 pm
Location: Steven Point, Wisconsin USA
Contact:

Re: Creating file in watch directory

#5 Post by Cliff Wiernik »

This is not a MS Server. It is Novell OES server. Workstation running the program is on a win7 workstation. It watchs a folder for any file, checking every 5 seconds. When it sees a file, it opens it and imports it, then deletes it.

We see a similar situation on a ftp site, where one size uploads a zip file and the other side monitors the site for the zip file. Occasionally the zip file downloaded has 0 bytes and then because the downloading side has a built in pause, the file then is put out there with the proper data. In this case, we can fix it if needed.

It is the first instance where we have seen this problem. It appears to only happen sporadically, but does happen. I don't know if first creating to a temporary location and then copying would be better as the file would be intact first.

User avatar
rdonnay
Site Admin
Posts: 4728
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: Creating file in watch directory

#6 Post by rdonnay »

You could try writing first to a local folder then do a copy to the Novell folder.
The eXpress train is coming - and it has more cars.

User avatar
Auge_Ohr
Posts: 1406
Joined: Wed Feb 24, 2010 3:44 pm

Re: Creating file in watch directory

#7 Post by Auge_Ohr »

Cliff Wiernik wrote:This is not a MS Server. It is Novell OES server. Workstation running the program is on a win7 workstation.
OK ... but your Client Workstation are Win7 and it might be are "Redirector" Problem of MRXSMB20.SYS

Question : on which Port does your Win7 Workstation communicate with NW Server ? UDP 136-139 or 445 ?
Cliff Wiernik wrote:It watchs a folder for any file, checking every 5 seconds. When it sees a file, it opens it and imports it, then deletes it.
Windows Timeout are 10 sec ...
greetings by OHR
Jimmy

Cliff Wiernik
Posts: 605
Joined: Thu Jan 28, 2010 9:11 pm
Location: Steven Point, Wisconsin USA
Contact:

Re: Creating file in watch directory

#8 Post by Cliff Wiernik »

Appears to use port 524.

skiman
Posts: 1185
Joined: Thu Jan 28, 2010 1:22 am
Location: Sijsele, Belgium
Contact:

Re: Creating file in watch directory

#9 Post by skiman »

Hi Cliff,

Can you modify the program that is watching?

I had the same problem in the past. I solved it this way.
I Create the data file with the name abcxyz.txt. When everything is finished, I create a second file with the same name, but another extention. abcxyz.ok. This file is 0 bytes.
The program that is waiting for the data is looking for the OK files. When it sees an OK file, it processes the TXT file with the same name.

This way it never starts processing a file which is not finished yet.

Another solution could be to save the file as abcxyz.notfinished. As soon as it is completely saved, you can rename it to abcxyz.txt. If the watching program doesn't process the notfinished files, it should also work without problems.
Best regards,

Chris.
www.aboservice.be

User avatar
Auge_Ohr
Posts: 1406
Joined: Wed Feb 24, 2010 3:44 pm

Re: Creating file in watch directory

#10 Post by Auge_Ohr »

Cliff Wiernik wrote:Appears to use port 524.
so it is NOT SMB1 ... as i wrote
it seem to me you got SMB2 Directory Problem ... look here
https://technet.microsoft.com/en-us/lib ... 10%29.aspx
greetings by OHR
Jimmy

Post Reply