I have a server set up which can accept multiple clients in different threads. Now the server keeps track of all client activities using a log feature which writes directly to a txt file. But soemtimes I notice when there are a lot of clients requesting there is an IOException becuase another process is using the log file. How do I synchronize or lock them? please help. I'm using C#.