JDCyrus 0 Light Poster

Hi. I'd like some help with a program that runs over a network.

My program uses queue-based distributed computing. Because the computers are all on a LAN and differ greatly in processing power, they receive objects to process only when they request them. (Some can process more than one object at once.) The master server creates an object and puts it in a Queue.Queue. Whenever a slave computer wants an object to process, it sends a request to the master, which then sends over an object. When it's done with the object, it sends it back over to the master. There is also a heartbeat system to make sure all the servers are still alive and on the network, and since the user can (and often will) close the master prematurely, it sends a signal to the slaves to shut down when it does.

I do all this using plain sockets. This works to some extent, but it requires the master to run three threads (one of which is a Timer) and four sockets per slave. In addition, it sometimes doesn't terminate properly, forcing me to end the process. This leaves residual data in the sockets which appears the next time I run the program, forcing me to change ports or reboot all the systems. I figure there has to be a better way.

What I'm looking for is a simple networking framework that allows each computer to simply wait in one thread until it gets something from another computer or until another thread gives it something to send. And it should be able to do this cleanly. Is there anything like this? Thanks in advance!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.