-
How hard is this?
I want to write a program that is to be deployed on a small LAN (15 pc's). One of the PCs will be nominated as the server (usually the first one to boot up in the morning) and the others will take their cues from it.
The server PC will keep a list of data and will distribute it to each of the other machines. Any of the PCs should be able to edit a small part of that data and relay the changes to the server PC, which then refreshes the other machines.
If the server PC shuts down then one of the other remaining PCs takes over the server role automatically.
How hard is this to implement?
Presumeably the best bet would be sockets and UDP comms.
I really don't know where to start learning about this so any advice would be great :thumb:
Thanks.
Des.
-
-
I don't think this would be too hard to write.
I would start with each machine having an INI file which points to all possible IP addresses (or maybe IP Ranges) that are valid. When the program starts it sends out a message to each of those IPs to see if there is a server running. If there is no server running, it sets itself to server mode. If there is a server running it registers itself with that server.
When data is updated, the server knows what machines have been registered and will send the updates to those machines.
When the server is being shut down, you can have it send out a message to the first IP in the registered computers saying that it is being shut down and that the first IP would then become the server. The old server would pass all IPs to the new server, so that it can keep up communication. It would also send a message to all the other IPs letting them know that the new machine is now the server.
You would also need to build in some fault tolerance in case the server closes unexpectedly. If one of the machines finds that the server is down, it will make itself the server and send a message to all of the IPs that are in its INI file.
To start this, I would use two machines on a network and just get the message exchaning code working. Using sockets is going to be your best bet and if nothing needs to leave the firewall, that will allow you more flexibility, becuase you don't have to worry about ports being blocked.
-
OK I'll give it a shot, thanks :) :thumb:
-
Would be a lot easier just to put a 'server' on your LAN - 15 PC's is a lot to have on a network with no dedicated server to centralise data and so forth.
-
Oh there is a server, believe!
Its just in a locked, air-conned room with CCTV and all that.
Our IT contractors don't let us plebs mess about with the server :) There's well over 1000 PC's on the network :eek: