Hi
I just started learning java and given an assignment to write simple server-client chat program.i wrote following code but getting problem with ih.Server is running finebut on client side program ,i am getting error og "unreachable statement "for pw.println(str);.Please help me out....
Thank You in advance
<script type="text/javascript">
<!--
import java.net.*;
import java.io.*;
import java.util.*;
import java.lang.*;
public class Client
{
Client()
{
try
{
String str;
Socket s=new Socket("localhost",1113);
System.out.println("Connection established");
OutputStream out=s.getOutputStream();
PrintWriter pw=new PrintWriter(out,true);
BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
while(true)
{
System.out.println("Enter ");
str=in.readLine();
}
pw.println(str);
}catch(Exception e){}
}
public static void main(String args[])
{
new Client();
}
}
//-->
</script>
<script type="text/javascript">
<!--
import java.net.*;
import java.io.*;
import java.lang.*;
class Server
{
public static void main(String args[])
{
try{
Socket s1=new Socket();
ServerSocket svr=new ServerSocket(1113);
System.out.println("Server Created");
s1=svr.accept();
InputStream in=s1.getInputStream();
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String str;
while(true)
{
str=br.readLine();
if(str.equals("stop"))
{break;}
System.out.println(str);
}
br.close();
s1.close();
}
catch(Exception e){}
}
}
//-->
</script>