import java.io.BufferedReader;import java.io.IOException;import java.io.InputStream;import java.io.InputStreamReader;public class TestNetSend { /** * @param args */ public static void main(String[] args) { InputStream inpStream = null; InputStream errStream = null; try { System.out.println("Bitte gib deinen Text ein"); System.out.println(" "); BufferedReader in = new BufferedReader( new InputStreamReader( System.in ) ); String a = in.readLine(); Process proc = Runtime.getRuntime().exec("net send 192.168.2.100 "+a); inpStream = proc.getInputStream(); errStream = proc.getErrorStream(); StringBuffer strBuf = new StringBuffer(); byte[] buf = new byte[80]; int len; while ((len = inpStream.read(buf)) > 0) { strBuf.append("STDOUT-Info: "+new String(buf, 0, len)); } while ((len = errStream.read(buf)) > 0) { strBuf.append("STDERR-Info: "+new String(buf, 0, len)); } System.out.println(strBuf.toString()); } catch (IOException ex) { ex.printStackTrace(); } finally { try { inpStream.close(); errStream.close(); } catch (Exception e) { e.printStackTrace(); } } } }