PC and Mac sharing a file on a Windows server
PC and Mac sharing a file on a Windows server
- Subject: PC and Mac sharing a file on a Windows server
- From: fred ross-perry <email@hidden>
- Date: Wed, 30 Jan 2008 11:41:32 -0800
- Thread-topic: PC and Mac sharing a file on a Windows server
Title: PC and Mac sharing a file on a Windows server
Hello,
We have an application that runs on many computers, all connected to the same file server. The application allows people to “log in” using unique user IDs. Only one computer can be logged in at a time under a given user ID.
To arbitrate this, there is a file on the server that contains a token for each computer, the value of which is the ID of who is logged in at that computer. Logging in consists of opening the file, writing a user ID into that computer’s token, and closing the file. Logging out consists of opening the file, writing zero into that computer’s token, and closing the file. Two computers can’t have the file open at the same time. I can’t log in if my ID is found in another computer’s token. Done.
What we are finding is that there are times when one computer does not see a change to the file right away. Here is the setup:
Computer A: Windows XP, app built using VC++ 6.0 and MFC
Computer B: MacBook Pro, OS X 10.4, built w/XCode and Carbon
Connected to the server via AFP
Server: Windows 2000 server with Services for Macintosh installed,
Which provides AFP.
I made two test programs, one for Win and one for Mac, to distill the issue. Each one does this:
Open the file
Seek to the token (at position 100000)
Read a 4-byte integer (the ID)
Add one
Seek to the token (at position 100000)
Write the incremented 4-byte integer
Flush
Close
Show the new value
Let’s say the value starts at 0. What you expect is that when you run this on computer A, is the value changing to 1. Then run it on computer B, and the new value should be 2. Etc.
What we are seeing is that frequently computer B does not see the file change immediately. If we use two PCs, no problem. If we use two Macs connected via SMB, no problem. If we use a PC and a Mac via SMB, no problem.
Our current theory is that this is an issue with synchronization between AFP and SMB within the Windows 2000 server. Does this ring true for anyone? Is there a way to deal with this within the Mac client code?
Thanks!
fred
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Filesystem-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden