Hello friends, actually i have a problem with following programs:
First:---------
import java.net.*;
import java.io.*;
public class SimpleServer{
public static void main(String[] a){
ServerSocket s=null;
try{
s=new ServerSocket(5432);
}catch(IOException e){
e.printStackTrace();
}
while(true){
try{
Socket s1=s.accept();
OutputStream s1out=s1.getOutputStream();
BufferedWriter bw=new BufferedWriter(new OutputStreamWriter(s1out));
bw.write("Hello Net World!!");
bw.close();
s1.close();
}catch(IOException e){
e.printStackTrace();
}
}
}
}
Second:----------
import java.net.*;
import java.io.*;
public class SimpleClient {
public static void main(String[] a) {
try
{
Socket s1 = new Socket("127.0.0.1", 5432);
InputStream is = s1.getInputStream();
DataInputStream dis = new DataInputStream(is);
System.out.println(dis.readUTF());
br.close();
s1.close();
}
catch (ConnectException con)
{
System.err.println("Coult not connect");
}
catch (IOException ex)
{
//ex.printStackTrace();
}
}
}
when i compile and run these programs in two different cmd windows nothing is shown as output, pls help!!