1. A simple chat system allows multiple clients to exchange messages in an interactive ways. Users type the information in lines at one client and then the information would be appeared in the output windows of all the other clients connected to the same chat room. (Bressoud, 2006)
Program Code for multiple users (Wachsmut, 2006)
import java.net.*;
import java.io.*
public class ChatServer implements Runnable
{ private ServerSocket server = null; private Thread thread = null;
privateChatServerThreadclient=null;
public ChatServer(int port)
{ try
{ System.out.println("Binding to port " + port + ", please wait ...");
server = new ServerSocket(port);
System.out.println("Server started: " + server);
start(); }
catch(IOException ioe)
{ System.out.println(ioe);}}
public void run()
{ while (thread != null)
{ try
{ System.out.println("Waiting for a client ...");
addThread(server.accept());}
catch(IOException ie)
{ System.out.println("Acceptance Error: " + ie);} } }
public void addThread(Socket socket)
{ System.out.println("Client accepted: " + socket);
client = new ChatServerThread(this, socket);
try
{ client.open();
client.start(); }
catch(IOException ioe)
{ System.out.println("Error opening thread: " + ioe); } }
- When users initialized a request , a socket will be opened and accepted
- Multiple users can join the chatserver with this recursive approach
2. Comparsion between peer-to-peer and grid (Termizel, 2006)
- Grids address the needs of scientific collabortions and commerce, however, P2P has been used mostly for file sharing. The communites are composed of anonymous individials
- Grid systems integrated resouces that are more powerful , diverse and better connected than P2P resources
- P2P systems deal with intermittent participation and highly variable behaviour compare with grid
- Grid applications are far more data intensive
- P2P communities is not larger than grid
- Grid technologies are standardized
3. Compare and contrast of Java and .Net (Wilipedia, 2009)
- Java platform is established in mid-1990 and .Net is established in year 2000
- Java can run in different operating systems like Unix, Linux , Mac OSX and Windows, however, .Net is mostly run under Windows
- .Net is designed to allow many different programming languages to use its runtime and libraries, however, Java platform is not used for multiple languages unitl now.
- Java is cross-platform and .Net is cross-language
References:
1. Bressoud, 2006, ' Two Client Instant Messaging System'
2.Wachsmut, 2006, 'Creating a Simple Chat Client/Server Solution'
3. Termizel, 2006, 'Peer - 2 - Peer Computing'
4.Wilipedia, 2009, ' Comparison of Java and .Net'