rmi passing parameters

S

smarto59

this my first java rather than rmi program. I faced a little problem
with passing parameters.I made lookup for the object in client side
then defined it. the program prompts the user to insert three String
data type statements using BufferedReader then passes them to the
remote method. in server side the first parameter is used to name a
new file using FileWriter and the second and third arguments to be
printed in the file.the result: the file is created successfully but
the two Strings are not printed.

this is a part of my code:

Client:

Code:
BufferedReader br = new BufferedReader(new
InputStreamReader(System.in));
remoteObject.NewFile(br.readLine(),br.readLine(),br.readLine());
br.close();

server:

Code:
public void NewFile(String name,String str1,String str2)
{
FileWriter fw = new FileWriter(name+".txt");
BufferedWriter bw = new BufferedWriter (fw);
bw.write(str1+" "+str2);
fw.flush();
bw.flush();
fw.close();
bw.close();
}

why don't the two Strings printed :x
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,825
Latest member
VernonQuy6

Latest Threads

Top