Multiple access to a file...
Lets say I have two clients connected to the server an they both need to download the new level. What is the most eligant way to have the two clients recieve the file at the same time?
I know that I could just keep track of how far along each client is in the file and seek to that position, and keep track of how many clients have access to the file so that I don't close it to early, but I'm wondering if there is a better way. Is there?
Useless Code
What I said above isn't very clear. I know how to send the files, and I could get it to work using fseek. I'm just wondering if there is a better way to read in from the file without haveing to seek to each client's position. I know you can't do this, but I'm wondering if there is something like:
FILE* file1 = fopen...
FILE* file2 = fopen...
Edited by - Mike on January 13, 2001 5:08:22 PM
if the file isnt too big......you could just already have all the info from the file loaded into memory. Say the file is 10 kb then you could do this when you start up the server
now have a separate thread for each client and send the data in buff to each client
"Now go away or I shall taunt you a second time"
- Monty Python and the Holy Grail
We are creating a Multi-player space strategy/shoot-em-up/RPG game.
Development is well under way and we do have a playable demo.
Always looking for help.
Digital Euphoria Soft
|
now have a separate thread for each client and send the data in buff to each client
"Now go away or I shall taunt you a second time"
- Monty Python and the Holy Grail
We are creating a Multi-player space strategy/shoot-em-up/RPG game.
Development is well under way and we do have a playable demo.
Always looking for help.
Digital Euphoria Soft
In may game the level file can include custom images and sounds. The file is to large to read into memory.
Useless Code
Useless Code
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement