my problem is related to file handling
-
i am working on client server application both are developed on mfc.My problem is that client create a file after writing put it in a directory on server and server is continuously searching that directory and try to open that file but still hold by client.How can i know that particular file is not hold by client. thank u in advance
-
i am working on client server application both are developed on mfc.My problem is that client create a file after writing put it in a directory on server and server is continuously searching that directory and try to open that file but still hold by client.How can i know that particular file is not hold by client. thank u in advance
One solution may be sending a parameter when client ends working with file. Another possibility (but I don't know if that is ok for you) is to use the "share priviliges" flags of the file. You can create the file to be used only by one application or by more as you want. Another one would be create another empty file that just hold the name of the first one + _busy or something like that, and deleting that sec file after ending the work with the first one. P.S. there must most probably be better solutions, my knowledge is limited, this is just a logic think.
Greetings. -------- M.D.V. ;) If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about? Help me to understand what I'm saying, and I'll explain it better to you “The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
modified on Wednesday, December 19, 2007 4:22:20 AM
-
i am working on client server application both are developed on mfc.My problem is that client create a file after writing put it in a directory on server and server is continuously searching that directory and try to open that file but still hold by client.How can i know that particular file is not hold by client. thank u in advance
Nalek came up with some solutions. Another one... Write to file AAAA.aaa, then when you're done with it, close it, and rename it to BBBB.bbb, and the server can then catch that file. I hope the server is not in a loop continouusly checking for the file - your users won;t thank you for that. I trust you're using
FindFirstChangeNotification
etc for this job. Iain. -
Nalek came up with some solutions. Another one... Write to file AAAA.aaa, then when you're done with it, close it, and rename it to BBBB.bbb, and the server can then catch that file. I hope the server is not in a loop continouusly checking for the file - your users won;t thank you for that. I trust you're using
FindFirstChangeNotification
etc for this job. Iain.Iain Clarke wrote:
Nalek came up with some solutions. Another one... Write to file AAAA.aaa, then when you're done with it, close it, and rename it to BBBB.bbb, and the server can then catch that file.
I suppose that is an irony to say my solutions suck. For next times, I prefer a simple "this is bad, is better that". I know I am limited, but I try and from corrections like yours
Iain Clarke wrote:
I trust you're using FindFirstChangeNotification etc for this job
I learn too.
Greetings. -------- M.D.V. ;) If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about? Help me to understand what I'm saying, and I'll explain it better to you “The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
-
Nalek came up with some solutions. Another one... Write to file AAAA.aaa, then when you're done with it, close it, and rename it to BBBB.bbb, and the server can then catch that file. I hope the server is not in a loop continouusly checking for the file - your users won;t thank you for that. I trust you're using
FindFirstChangeNotification
etc for this job. Iain.Iain Clarke wrote:
I hope the server is not in a loop continouusly checking for the file...
That's what his "server is continuously searching that directory" comment is implying.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne