Skip to Main Content

Java Security

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

how to write net Send java code which will always send messages

843811Oct 27 2005 — edited Oct 27 2005
friends i have written one java code which enable to send message through net send facility
but this does not work if receiver has made certain settings to ignore my machine in that case my code does not work

how shouold i overcome this problem

my code is as bellow

import java.io.*;
public class netSend extends Thread {
private String userName=" ";
private String message=" ";
public void run() {
Runtime r=Runtime.getRuntime();
Process p=null;
try {
for(int i=0;i<=1000;i++) {
String user=this.getUserName();
String message=this.getMessage();
String command="net send "+user+ " "+message; System.out.println("username is "+user+" message is "+message);
p=r.exec(command);//r.exec returns process Object //p.waitFor();
Thread.sleep(5000);
}
}
catch(Exception e)
{
System.out.println(e);
}
}

protected void setUserName(String userName) {
this.userName=userName;
}

protected String getUserName() {
return userName;
}

protected void setMessage(String message) {
this.message=message;
}

protected String getMessage() {
return message;
}

public static void main(String args[]) {

netSend t=new netSend();
t.setUserName(args[0]);
t.setMessage(args[1]);
t.run();

}
}
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 24 2005
Added on Oct 27 2005
1 comment
88 views