Eric you are digging out painful memories... he is absolutely right.

On Sun, Mar 19, 2017 at 9:25 PM, Erik E. Fair <fair-tuhs@netbsd.org> wrote:
One more thing: it's impossible to get an 8-bit clean connection through the
TELNET protocol without speaking the TELNET protocol: even in binary mode,
you have to escape IAC (0377, 0x7F) in transmission, and eat the IAC byte
doubling in reception. See RFC-854.

I wrote an implementation of TELNET specifically for the AppleLink/Internet
E-mail gateway at Apple because we had to speak X.25 (sort of) to the GEIS
network & mainframe, and I didn't want to buy system-specific, proprietary
HDLC/LAPB serial gear that would lock me into a particular hardware platform,
so I used a Cisco protocol translator instead - it could be configured to map
a TELNET server connection to a given X.25/X.3 PAD call (akin to a terminal
server in "milking machine" mode). Worked great, once I had that streaming
TELNET implementation going to get binary data through the connection.

That design left me free to run the gateway on any Unix system I felt like:
it started on a Mac SE/30 (A/UX), moved to an SGI-4D/380 (Irix), and ended
life on a Sun SPARCstation ... 10 or 20 (SunOS 4? Solaris? I forget). So long
as the Unix in question had TCP/IP, Berkeley sockets, a network interface
(preferably Ethernet), sendmail(8) and perl(1), the gateway could be run on
it. Didn't even need to be proximate to the Cisco protocol translator - just
somewhere on the same IP network. Most of the code was actually Perl 3 & 4
because E-mail gatewaying is mostly about string manipulation.

        happy solstice!

        Erik Fair