Readline on TCP (telnet)

643 views
Skip to first unread message

Axel Kittenberger

unread,
Oct 12, 2011, 5:01:20 PM10/12/11
to nodejs
Hello List. I'm trying to get readline-like functionality to work on
TCP Sockets. The Readline module works great with process.stdin/out.
It also understands the commands given via a TCP socket, but there
isn't any readline functionality on TCP: no tab completion, no arrow
history etc. I looked into the source of node.js' lib/readline.js, and
its obvious it doesn't do it, because the TCP connection fails on
'isatty'.

To solve this, shouldn't it be possible to open a pseudo tty and
stream the data through it, so it becomes a tty? I'm just missing any
call for this. There is a tty.open() but it must have a process to
spawn, it cannot use the other side of the connection to be held by
the node.js server again, like doing the shell itself with the
readline library.

In src/node_stdio.cc there seems to be a:
NODE_SET_METHOD(target, "openpty", OpenPTY);
But it isn't available anywhere to the server script, is it?

Kind regards,
Axel

Axel Kittenberger

unread,
Oct 13, 2011, 3:48:32 AM10/13/11
to nodejs
To answer my own question. I discovered via
process.binding('stdio').opentty I could create a pty, and I was able
to pipe the TCP data to its slave part, altough it kinda worked, it
didn't really work readline-ish or feel anything like a terminal. I
just suppose there is so much more to a proper telnet/terminal
implementation than a Raw Stream pushed through a pty and I was just
kinda of naive to try to make it work like that.

- Axel

Chris Dew

unread,
Nov 6, 2012, 4:09:09 AM11/6/12
to nod...@googlegroups.com
I've also come across an aspect of this problem, and have submitted it as a bug.  It has been wrongly closed, so I may need to resubmit it.


Regards,

Chris.
Reply all
Reply to author
Forward
0 new messages