diff --git a/pom.xml b/pom.xml
index ccf5be2..e078f1e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -2,7 +2,7 @@
4.0.0
at.downardo
j3270Server
- 0.0.3
+ 0.0.4
Java 3270 Server
jar
This libary allows the user to write servers for IBM 3270 Terminal emulators.
diff --git a/src/main/java/at/downardo/j3270Server/Telnet.java b/src/main/java/at/downardo/j3270Server/Telnet.java
index 58d9d14..e07fb5e 100644
--- a/src/main/java/at/downardo/j3270Server/Telnet.java
+++ b/src/main/java/at/downardo/j3270Server/Telnet.java
@@ -26,6 +26,46 @@ public class Telnet {
private static final byte TERMINALTYPE = (byte)0x18;
private static final byte EOR = (byte)0x19;
+ /**
+ * UnNegotiateTelnet will naively (e.g. not checking client responses) attempt
+ * to restore the telnet options state to what it was before NegotiateTelnet()
+ * was called.
+ * @param out
+ * @param in
+ */
+ public static void UnNegotiateTelnet(BufferedOutputStream out, BufferedInputStream in) {
+ byte[] _trash = new byte[255];
+ byte[] _t = {IAC,WONT,EOR,IAC,WONT,BINARY};
+
+ try {
+ out.write(_t);
+ out.flush();
+ in.read(_trash);
+
+ byte[] _2t = {IAC,DONT,BINARY};
+ out.write(_2t);
+ out.flush();
+
+ in.read(_trash);
+
+ byte[] _3t = {IAC,DONT,EOR};
+
+ out.write(_3t);
+ out.flush();
+
+ in.read(_trash);
+
+ byte[] _4t = {IAC,DONT,TERMINALTYPE};
+
+ out.write(_4t);
+ out.flush();
+
+ in.read(_trash);
+
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
/**