Java Reference
In-Depth Information
int cmd = in.read();
if (cmd == 0x0ff)
return 0x0ff;
int opt = in.read();
if (cmd == 0xfd || cmd == 0x0fb) {
out.write (0x0ff);
out.write (cmd == 0xfd ? 252 : 254);
out.write (opt);
out.flush();
}
}
}
/** Main receive loop running in the background */
public void run() {
StringBuffer buf = new StringBuffer();
try {
while (!leave) {
do {
int i = in.read();
if (i == -1) disconnect();
else if (i == '\r' || i >= ' ')
buf.append ((char) i);
}
while (!leave && in.available() > 0
&& buf.length() < 1024);
show (buf.toString());
buf.setLength (0);
}
}
catch (Exception e) {
if (!leave) show (e.toString() + "\r");
disconnect();
}
}
}
List incoming = new List ("MidpTerminal", Choice.IMPLICIT);
TextBox uriField = new TextBox
("Connect to:", "http://www.kawt.de/", 100, TextField.ANY);
TextBox sendField = new TextBox ("Send:", "", 100, TextField.ANY);
Command connectCmd = new Command ("Connect", Command.SCREEN, 1);
Command sendCmd = new Command ("Send", Command.SCREEN, 1);
Command okCmd = new Command ("Ok", Command.OK, 1);
Command abortCmd = new Command ("Abort", Command.CANCEL, 1);
Handler handler = null;
Display display;
Search WWH ::




Custom Search