Below is the code for Client & Server
I m trying 2 run it on 21 different machines connected to internet(1 machine runs Client & other Server).

Code:
//Client.Java
import java.net.*;
import java.io.*;
class Client 
{
 public static void main(String[] args) 
{
 Socket client;
 String host="home";//home is Server's computer name
 
 try
  {InetAddress adressen = InetAddress.getByName(host);
   client = new Socket(adressen,4444);
   BufferedReader scanf = new BufferedReader(new
  InputStreamReader(client.getInputStream()));
   String someString = scanf.readLine();
  System.out.println("From Server: "+someString);
  client.close();
 }
 catch(Exception e)
  {
     System.out.println(e);  
  }
 }
}
Server
Code:
// Server.Java
import java.net.*;
import java.io.*;
class Server {
public static void main(String[] args) {
boolean finished = false;
try{
ServerSocket listener = new ServerSocket(4444);
while(!finished)
{Socket to_client = listener.accept();
OutputStream out = to_client.getOutputStream();
PrintWriter pout = new PrintWriter(out, true);
pout.println("Hello! this is server talking to you.");
to_client.close();
}
listener.close();
}// end of try
catch(Exception ie) {
System.out.println(ie);
}
}
}
But its not working & giving error:
java.net.UnknownHostException: home: home

PLEASE GUIDE ME!!

Last edited by shabbir; 1Sep2010 at 07:47.. Reason: Code blocks