0

net sendを使用して次の Java プログラムを実行しました。メッセージが正常に送信されたと表示されますが、メッセージが表示されませんでした。コードは次のとおりです。

  import java.io.*;
  import java.net.*;
  class sample{
   public static void main(String args[]) throws Exception
    {
    try{
        Runtime r=Runtime.getRuntime();
        Process p=null;
        String msg;
        String TRIP;
        String cmd;
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        System.out.println("Enter ip address of remote host");
        TRIP=br.readLine();
        System.out.println("Enter the msg to be sent to remote host");
        msg=br.readLine();
        cmd="net send"+TRIP+""+msg;
        p=r.exec(cmd);
        Thread.sleep(1000);
        System.out.println("msg soc sent to the sysytem");
        }catch(Exception e){
          System.out.println(e);
        }
      }
    }
4

1 に答える 1