Manimala Kumar

Greenhorn
+ Follow
since May 24, 2001
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Manimala Kumar

Hello everybody,
I'm doing a project on mail client system. For remote users i need a ftp of the required file. I am running BRS WebWeaver in my pc and if I try from other pc's with anonymous ftp(i.e. ftp 10.101.1.96 etc.),then it works. But as soon as I try it with my socket initially it flashes a ready message and after that it automatically gets disconnected. So I'm unable to send further commands.
If anybody knows it, please help me. I'm appending my progs here.
Manimala.

//applet code
import java.applet.*;
import java.awt.*;
import java.io.*;
import java.awt.event.*;
import java.util.*;
import java.net.*;
import javax.swing.*;
public class japp extends Applet implements ActionListener
{
String attach = null;
Socket localSocket;
PrintWriter outbnd;
BufferedReader inbnd;
String s;
private Button b;
String line = null;
private TextField t2;
public void init()
{
setLayout(new FlowLayout());
attach = getParameter("c"); //get file name with full path from prev text box
t2 = new TextField(60);
add(t2);
b = new Button("Connect");
b.addActionListener(this);
add(b);
}
public void actionPerformed(ActionEvent e)
{
if(e.getSource() == b) //Create a socket
try
{
t2.setText(attach);
localSocket = new Socket("10.101.1.96",21); //Setup data
inbnd = new BufferedReader(new InputStreamReader (localSocket.getInputStream()));
outbnd= new PrintWriter(localSocket.getOutputStream());
//While we have a connection
//Read Texfield value
// read incoming string from socket
line = inbnd.readLine();
t2.setText(line);
outbnd.println("anonymous");
outbnd.flush();
line = inbnd.readLine();
t2.setText(line);
outbnd.println("mani@lycos.com");
outbnd.flush();
line = inbnd.readLine();
t2.setText(line);
outbnd.println("get "+attach);
outbnd.flush();
line = inbnd.readLine();
t2.setText(line);
outbnd.println("bye ");
outbnd.flush();
outbnd.close();
inbnd.close();
localSocket .close();
}
catch(UnknownHostException unc)
{
System.out.println("Connection why not connected");
}
catch(IOException ioe)
{
System.out.println(ioe.getMessage());
}
}
public static void main( String[] args )//without/with it's ok
{
netappsock applet = new netappsock();
JFrame frame = new JFrame();
frame.setTitle( "Socket Test" );
frame.getContentPane().add( applet , BorderLayout.CENTER );
applet.init();
applet.start();
frame.setSize( 460 , 360 );
Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
frame.setLocation( ( d.width - frame.getSize().width ) / 2 ,( d.height - frame.getSize().height ) / 2 );
frame.setVisible( true );
}

}

//html code
<html>
<head></head>
<body>
<applet code=japp.class height=400 width=600>
<param name="c" value="C:\jdk1.3\bin\abcd.txt">
</applet>
</body>
</html>


------------------
21 years ago