This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes how to send message from Command prompt to the user in network  and  who ignore me Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "how to send message from Command prompt to the user in network  and  who ignore me " Watch "how to send message from Command prompt to the user in network  and  who ignore me " New topic
Author

how to send message from Command prompt to the user in network and who ignore me

ganesh pol
Ranch Hand

Joined: Apr 29, 2005
Posts: 151
friends i have created one code it enables to the user to send message
continuously
but if receiver ignores me from network then my code does not work (receiver does not get my message )

how to send messages although user has ignore my machine from network
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);//causes current thread to sleep for 5 seconds
}
}
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();

}
}
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41180
    
  45
Has it occurred to you that it would be extremely annoying to have a dialog box pop up on your screen every 5 seconds, and that that might be the reason that other people turned off their Messaging Service, so that they can ignore you?
[ October 28, 2005: Message edited by: Ulf Dittmer ]

Ping & DNS - my free Android networking tools app
 
 
subject: how to send message from Command prompt to the user in network and who ignore me
 
Similar Threads
Runtime.exec() file problem
Problem with running a program from Java file
how to net Send from my java code although receiver has disable it
How to display contents of JList or drop down list?
Exception in thread "AWT-EventQueue-0" java.lang.NoSuchMethodError: