Author: sebb
Date: Wed Mar 2 21:55:35 2011
New Revision: 1076421
URL: http://svn.apache.org/viewvc?rev=1076421&view=rev
Log:
NET-343 Telnet client: Support Client-initiated Subnegotiation Messages
Modified:
commons/proper/net/trunk/src/changes/changes.xml
commons/proper/net/trunk/src/main/java/org/apache/commons/net/telnet/TelnetClient.java
Modified: commons/proper/net/trunk/src/changes/changes.xml
URL:
http://svn.apache.org/viewvc/commons/proper/net/trunk/src/changes/changes.xml?rev=1076421&r1=1076420&r2=1076421&view=diff
==============================================================================
--- commons/proper/net/trunk/src/changes/changes.xml (original)
+++ commons/proper/net/trunk/src/changes/changes.xml Wed Mar 2 21:55:35 2011
@@ -54,6 +54,9 @@ The <action> type attribute can be add,u
<body>
<release version="3.0" date="TBA" description="TBA">
+ <action issue="NET-343" dev="sebb" type="add">
+ Telnet client: Support Client-initiated Subnegotiation Messages.
+ </action>
<action issue="NET-270" dev="sebb" type="fix">
Incorrect error handling in method initiateListParsing of
FTPClient.
</action>
Modified:
commons/proper/net/trunk/src/main/java/org/apache/commons/net/telnet/TelnetClient.java
URL:
http://svn.apache.org/viewvc/commons/proper/net/trunk/src/main/java/org/apache/commons/net/telnet/TelnetClient.java?rev=1076421&r1=1076420&r2=1076421&view=diff
==============================================================================
---
commons/proper/net/trunk/src/main/java/org/apache/commons/net/telnet/TelnetClient.java
(original)
+++
commons/proper/net/trunk/src/main/java/org/apache/commons/net/telnet/TelnetClient.java
Wed Mar 2 21:55:35 2011
@@ -207,6 +207,30 @@ public class TelnetClient extends Telnet
}
/* Code Section added for supporting AYT (start)*/
+ /***
+ * Sends a protocol-specific subnegotiation message to the remote peer.
+ * {@link TelnetClient} will add the IAC SB & IAC SE framing bytes;
+ * the first byte in {@code message} should be the appropriate telnet
+ * option code.
+ *
+ * <p>
+ * This method does not wait for any response. Subnegotiation messages
+ * sent by the remote end can be handled by registering an approrpriate
+ * {@link TelnetOptionHandler}.
+ * </p>
+ *
+ * @param message option code followed by subnegotiation payload
+ * @throws IllegalArgumentException if {@code message} has length zero
+ * @throws IOException if an I/O error occurs while writing the message
+ ***/
+ public void sendSubnegotiation(int[] message)
+ throws IOException, IllegalArgumentException
+ {
+ if (message.length < 1)
+ throw new IllegalArgumentException("zero length message");
+ _sendSubnegotiation(message);
+ }
+
/* open TelnetOptionHandler functionality (start)*/
/***