maxsap
maxsap

Reputation: 3001

running sipp from java

I am programming a Java interface for the sipp command line program. My current code is:

 ProcessBuilder builder = new ProcessBuilder("sipp", "-sn uac",
              "127.0.0.1");
        Map<String, String> environment = builder.environment();
        Process javap = builder.start();
        InputStreamReader tempReader = new InputStreamReader(new BufferedInputStream(javap.getInputStream()));
        BufferedReader reader = new BufferedReader(tempReader);
        while (true){
            String line = reader.readLine();
            if (line == null)
                break;
            System.out.println(line);
            }

This does not work for me thought, I have sipp environment variable set so this is not the problem. The standard output is sipp's help message. What am I doing wrong? Also I would like to know once I got sipp running is it possible to pass arguments to the processBuilder object associated with it so I can change the call rate? i.e. sipp let users change call rate by pressing + , - , * is this possible?

Upvotes: 1

Views: 1309

Answers (1)

Jonathon Faust
Jonathon Faust

Reputation: 12543

Try breaking up the -sn and uac parameters:

ProcessBuilder builder = new ProcessBuilder("sipp", "-sn", "uac", "127.0.0.1");

Also I would like to know once I got sipp running is it possible to pass arguments to the processBuilder object associated with it so I can change the call rate?

If sipp is expecting input from standard in, you should be able to grab an output stream (javap.getOutputStream()) to the process and write commands to it. I don't know anything about sipp to tell you whether that's how it works, though.

Upvotes: 1

Related Questions