I have come across a couple of proprietary applications on Linux platform which are administered via telnet. Remote telnet is not enabled but on the host you do a telnet session. You get an interface where you enter commands to make the application work. I was wondering how a telnet interface is built for any particular application. Not looking for a step-by-step, just a basic/general/big-picture answer of how one can approach building a telnet interface for an application.
+1
A:
telnet is based on the TCP/IP protocol. To "do" telnet from a C program, you'd start messing with sockets, accept()
-ing connections and reading and writing to them using fork()
-d threads (that's VERY briefly it).
If the app is already there, and already communicates to the console via stdin/stdout, you can rig a telnet interface on to it using (a) some configuration in your Internet daemon, (x)inetd
, or by misusing the Swiss Army knife of TCP/IP, netcat
.
The docs for both those programs describe how to set things up, vaguely. If you need more help, you know where to ask!
Carl Smotricz
2009-11-07 17:42:44