File locking over Samba
I'm using samba, and I have multiple OS's accessing files, including a program on the server itself. When the file is being sent over samba, I want it to be locked so the server's program can't read it. Once transfer is complete, it releases the lock and the server can read it. Likewise, I need the server to lock the file when it is reading it so no clients can modify the file while it's being read.
My main questions are:
How would I do this (any language)?
Can this even be done over Samba from a Windows client AND Linux client?