Hello
I've written an applet to invoke a servlet it gives the foll error message==>
Connection rejected: 'Login timed out after: '5000' ms on socket: 'Socket[addr=127.0.0.1/127.0.0.1,port=16
here's what my applet looks like==>
import java.awt.*;
import java.applet.*;
import java.awt.event.*;
import java.io.*;
import java.net.*;
/*
<applet code="ReadWriteApp" width="400" height="400">
</applet>
*/
public class ReadWriteApp extends Applet implements ActionListener{
Button Connect;
TextField tf;
public void init(){
tf = new TextField();
Panel p = new Panel();
Connect = new Button("Connect");
Connect.addActionListener(this);
p.add(Connect);
p.add(tf);
add(p);
}
public void actionPerformed(ActionEvent ae){
tf.setText("sunil");
callServlet();
}
public void callServlet(){
try{
URL url = new URL("http://localhost:7001/MyCom");
String qry = URLEncoder.encode("sunil")+ "=" + URLEncoder.encode("sunilkumre");
URLConnection uc = url.openConnection();
uc.setDoInput(true);
uc.setDoOutput(true);
uc.setUseCaches(false);
uc.setRequestProperty("Content-type", "application/x-www-form-urlencoded");
uc.setRequestProperty("Content-length", "" + qry.length());
// Write out post data
DataOutputStream out = new DataOutputStream(uc.getOutputStream());
out.writeBytes(qry);
out.flush();
out.close();
}
catch(MalformedURLException me){
}
catch(IOException me){
}
}
}
What could be the problem?
thanks in advance
Sunil.