Nuno Carvalho wrote:
> > The terminal type option should be sent by the client to the server.
> > If you are going to implement the telnet protocol yourself, you need
> > to:
> >
> > 1. Watch for the terminal sending `WILL TERMINAL-TYPE'.
> > 2. Reply with `DO TERMINAL-TYPE'.
> > 3. Send `SB TERMINAL-TYPE SEND'.
> > 4. Watch for `SB TERMINAL-TYPE IS ...'.
> > 5. Store the terminal type which the terminal sends.
>
> I still had no success with that! ;( If you could send me this source
> code part it would be great for me!
Obtain the source for in.telnetd (e.g. from one of the NetKit
packages), and look at that. I don't know of any simpler program which
attempts to implement the telnet protocol.
> I made the following program and it works as I want! When terminal don't
> support it just shows as normal characters.
>
> Meanwhile, this is sent to sdout ! How can I send this to a socket
> descriptor!?
For the kind of program which you seem to be writing, you should
probably use dup2() to make the socket descriptor correspond to the
process' stdin, stdout and stderr.
In fact, you should probably just use inetd to handle the connection
details, and use in.telnetd to handle the telnet protocol. That way,
you just need to write a program which talks to a terminal which is
connected to stdin and stdout.
--
Glynn Clements <[EMAIL PROTECTED]>