P
Per Magnus L?vold
Hi,
I have tried to figure out how to make my Java program simulate
control-z (^z) being pressed.
The program communicates over the serial port with a modem
/* sample code */
..
..
sp = (SerialPort) port.open("Test", 1000);
ps = new PrintStream(sp.getOutputStream());
..
..
public void sendBytes(String s) {
for (int i = 0; i < s.length(); i++) {
char b = s.charAt(i);
ps.write(b);
}
}
/* end sample code */
My question is this:
How can I make the Java program send the equivalent of control-z to
the modem?
Typing control-z in hyperterminal manually works, but I want the Java
program to do this. I have thought of using:
sendBytes(KeyEvent.CONTROL+"z");
But this doesn't work.
I find in another posting that "control-c has the numerical value of
3"
http://www.google.com/groups?hl=no&...r=&ie=ISO-8859-1&q=java+control-c+serial+port
....and someone tip'ed me that control-z then might be 26, but that
does not seem to be right.
Hope someone can help me!
Regards,
Per Magnus
I have tried to figure out how to make my Java program simulate
control-z (^z) being pressed.
The program communicates over the serial port with a modem
/* sample code */
..
..
sp = (SerialPort) port.open("Test", 1000);
ps = new PrintStream(sp.getOutputStream());
..
..
public void sendBytes(String s) {
for (int i = 0; i < s.length(); i++) {
char b = s.charAt(i);
ps.write(b);
}
}
/* end sample code */
My question is this:
How can I make the Java program send the equivalent of control-z to
the modem?
Typing control-z in hyperterminal manually works, but I want the Java
program to do this. I have thought of using:
sendBytes(KeyEvent.CONTROL+"z");
But this doesn't work.
I find in another posting that "control-c has the numerical value of
3"
http://www.google.com/groups?hl=no&...r=&ie=ISO-8859-1&q=java+control-c+serial+port
....and someone tip'ed me that control-z then might be 26, but that
does not seem to be right.
Hope someone can help me!
Regards,
Per Magnus