sockets: char-mode & getpeername ?

Joseph Hollosi <hollosi@helios.ucsc.edu> hollosi at taiyang.ucsc.edu
Sun Jun 30 18:16:49 AEST 1991


I am writing a server to which I want to connect by a usual
"telnet hostname port" command. Everything works, except two things:

1. how can I read() input which is not terminated by <Return>; it seems,
   that read() doesn't read anything (even I want to read one character only)
   until a line is typed in. ("man telnet" mentions a char-mode, but I want
   to set that from the other side)?
   I think this may be solved by using non-blocking read, but I would prefer
   the blocking version, because it gives you the chance to discover if the
   telnet is broken (killed) on the other side.
2. how can I get the name of machine from where the telnet is initiated;
   I tried getpeername(), but it gave some mess?

Thanks, please reply to <hollosi at helios.ucsc.edu>,
Joseph.



More information about the Comp.unix.programmer mailing list