$29
HostServer Instructions:
• This assignment is straightforward: run the HostServer. Comment it. Submit it.
• Here is the HostServer code.
• Download the code, compile it, run it:
◦ javac HostServer.java
◦ java HostServer
• Follow the instructions in the program console and on the web page to spawn new agents and make them migrate.
• You will connect from your Firefox browser (or other?) at http://localhost:4242
• View the source of the web page that pops up to understand how this works.
• Read about the details of the program in the web page below, and in the PowerPoint lecture.
• Add your comments to the code.
• Submit to D2L.
• Nameserver link, for fun. Keeps track of the current location, and group, of each full Distributed Intelligent Agent.
• Thanks John Reagan for updates to the code.
Full DIA Instructions:
1. Links are here for the full DIAgent Program assignment.
2. Download the java file for the Host Server and compile it. Run the server. Connect to the server from your FireFox (or other) browser at http://localhost:4242. Repeat for two or three clients, running concurrently. Follow the instructions posted on the browser, by the server, to update the state of the various conversations. Cause some of the agents to migrate to different ports. Refer to the execution instructions for the Hostserver if needed. VIEW THE SOURCE of the web pages to understand how the agents migrate.
Thanks also to James Raitsev that has a version with very excellent comments at HostServer.java Raitsev though this code may not work with all browsers.
3. Here is the text version of the Execution Instructions for the HostServer. The client is simply a web browser pointed to localhost:4242 to start. (Yes, the DIA port may be different.) Here is code to get next available port
4. Add your own comments to this pedagogical code (required!), to show that you understand how it works.
5. The HostServer uses a simple counter to get new ports for agents. But code is provided to have the system find the next available port. Consider rewriting your HostServer code to integrate the more graceful code for getting new agent ports. But, this is not required.
6. Submit HostServer.java WITH YOUR COMMENTS to D2L.
7. There is no checklist for this "get it running with comments" assignment.
8. Note: In this HostServer preliminary assignment, because we initiate migration from the web client, we can migrate the agent, capture the new address of the agent, install this in our dynamic HTML and send it back to the client all as part of the one request-response step. In this way the client always knows how to reach the migrated agent.
In the larger assignment, the agent would migrate autonomously, and the client will not know where it has gone. Thus we must leave behind a zombie, to point to the new location when the client connects, or must maintain a NameServer that clients connect to, which then contacts the agent at its currently location, or ...[fill in your own solution].
9. Note: In this HostServer preliminary assignment, to keep things simple, the agents all run under the single HostServer. In the larger assignment we would use multiple HostServer hosts (possibly running on different machines at different IP addresses). However the code is virtually all the same. One will simply have to replace the hard-coded address and port of the current HostServer with some other HostServer IP address and port, and everything else is handled by the current code.