On Wed, 23 Dec 1998, Glynn Clements wrote:
> > 1. I don't want to use dup2() to use stdout as socket descriptor! I need
> > stdout to send results from server(like: got connection from
> > 127.0.0.1 on port # 2344).
>
> A server shouldn't be writing to the stdout/stderr which it inherited.
> It should use either a logfile or the syslog facility for this.
You're rigth. I'll try to do it later. BTW this is not a daemon (i'm
thinking on put it as option).
> Also, note that tputs() uses the function which is provided as the
> third argument to actually send each character. Instead of using
> putchar(), write your own function which uses fputc to write the
> character to the socket.
int tputs(const char *str, int affcnt, int (*putc)(int));
Could you explain me better how to do it ?
1. third argument [int (*putc)(int)] of tputs() only send one argument
to those argument! How can I also send client's descriptor ?
2.
int fputc(int c, FILE *stream);
Second argument of fputc() is a (FILE *) and the client's
descriptor it's an integer (int). Maybe try write or send !?
> It sounds as if you're not checking the return value from tigetstr().
> It will return `(char *)-1' if the capability doesn't exist, or isn't
> a string-valued capability. If you attempt to dereference this, you
> will get a segfault.
That's rigth! :-) It was my mistake. ;)
> > setupterm( "vt100", client_fd, (int*)0 );
>
> This will only work if the client happens to use the same escape
> sequences as a vt100.
I had changed from "vt100" to (char*)0 !! It's better, rigth !?
> The bottom line is that you are trying to do too many things yourself.
I don't know. My project it's for an Introduction to Networking ...
I need use socket(), accept(), listen(), etc ...
> You should be using inetd to handle the connection, and in.telnetd to
> handle the telnet protocol. Your program should just assume that there
> is a terminal connected to stdin/stdout.
What do you mean by handle connections using inetd !? I'm using
telnet/tcp/23 . I need to use the protocol's stack TCP/IP!
The same question about in.telnetd !
Best regards,
Nuno Carvalho
จจจจจจจจจจจจจจจจจจจจจจจจจจจจจจ
Nuno Emanuel F. Carvalho
Dep. Informatics Engineering
University of Coimbra
PGP key available at finger
จจจจจจจจจจจจจจจจจจจจจจจจจจจจจจ