[plt-scheme] telnet client in scheme
Neil W. Van Dyke wrote:
> For list-related administrative tasks:
> http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>
>Chris <chris81 at wanadoo.fr> writes at 12:13 04-Jun-2003 +0200:
>
>
>>I just want to know if a client telnet made in scheme allready exist and
>>
>>
>
>One might exist (I don't know), but writing your own is a really good
>learning exercise.
>
>
>
>>and it's send me nothing back but i see the connexion opened in the telnetd
>>log. Am I missing something ?
>>
>>
>
>Perhaps the Telnet server is not sending a full line; for example, maybe
>it's just sending "Password: " without a newline sequence. Or maybe
>it's using a nonstandard newline convention, like CR (PLT's "read-line"
>can be made to handle this, but there's a better way).
>
>Instead of using "read-line", you probably want your code to read single
>characters or blocks of characters, rather than waiting for the server
>to send a newline. You will need this for other parts of the protocol
>anyway. Here's a simple variation on the code you posted:
>
> (display "*DEBUG* Connecting...\n")
>
> (define-values (p-in p-out) (tcp-connect "host" 23))
>
> (display "*DEBUG* Connected.\n")
>
> (let loop ()
> (display "*DEBUG* Waiting for character...\n")
> (let ((c (read-char p-in)))
> (printf "*DEBUG* Read character: ~S\n" c)
> (loop)))
>
>If this code doesn't read any characters from your Telnet server, then
>it could be waiting for the client to send one or more newlines or it
>could be waiting for the client to initiate a cryptographic
>authentication. Don't think too hard about "*DEBUG*" messages that
>aren't appearing, since they might be stuck in unflushed I/O buffers.
>Try running a protocol sniffer or packet analyzer, like the free
>Ethereal, while you connect to your Telnet server with your system's
>Telnet client, to see how it works.
>
>Once you can read and write single characters with your Telnet server,
>take a look at the PLT procedures "read-string-avail!/enable-break" and
>"write-string-avail/enable-break", and "object-wait-multiple" for how to
>do this robustly and more efficiently.
>
>Searching for "telnet" from "http://www.rfc-editor.org/rfcsearch.html"
>yields over 100 documents, most of which are not relevant to you. RFC
>318 ("ftp://ftp.rfc-editor.org/in-notes/rfc318.txt") might be a good
>starting point.
>
>
>
I once wrote me a little telnet client.
If you want it, there's a file attached.
By the way, if anyone can figure out why this programs slows down the
more you use it, I'd appreciate it.
Yours truly,
Katsmall T. Wise, Esquire.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20030606/3c45cf5d/attachment.html>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: telnet-client-2.scm
URL: <http://lists.racket-lang.org/users/archive/attachments/20030606/3c45cf5d/attachment.ksh>