Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

how to net Send from my java code although receiver has disable it

ganesh pol
Ranch Hand
Posts: 151
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
friends i have modified one code it enables to the user to send message
but if receiver ignores me from network then my code does not work
how to send messages although user has disable my machine
code is as bellow

public class netSend extends Thread {

private String userName=" ";
private String message=" ";

public void run()
Runtime r=Runtime.getRuntime();
Process p=null;
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
Thread.sleep(5000);//causes current thread to sleep for 5 seconds
catch(Exception e)

protected void setUserName(String userName){

protected String getUserName(){
return userName;

protected void setMessage(String message){

protected String getMessage(){
return message;

public static void main(String args[]) {

netSend t=new netSend();


I am going to test your electrical conductivity with this tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!