[plt-scheme] Re: run-server

From: Paulo J. Matos (pocm at mega.ist.utl.pt)
Date: Tue Oct 8 14:42:34 EDT 2002

> Following up on Matthew's suggestions (because I needed to play
> with this capability
> for another project...)
> 
> 
> (require (lib "thread.ss"))
> (define echo-port 23421)
> 
> (define (echo-server inport outport)
>   (let ((v (read-line inport)))
>     (when (not (eof-object? v))
>       (display v outport)
>       (display #\newline outport)
>       (echo-server inport outport))))
> 
> (run-server echo-port echo-server #f)
> 
> 
> (define hostname "localhost")
> (define echo-port 23421)
> 
> (define (echo inport outport)
>   (let ((v (read-line)))
>     (when (not (eof-object? v))
>       (display v outport)
>       (display #\newline outport)

I used (newline outport)
Same thing afaik.

>       (display (read-line inport)) (newline)
>       (echo inport outport))))
> 
> (call-with-values
>  (lambda () (tcp-connect hostname echo-port))
>  echo)

-- 
Paulo J. Matos : pocm(_at_)mega.ist.utl.pt
Instituto Superior Tecnico - Lisbon    
Software & Computer Engineering - A.I.
 - > http://mega.ist.utl.pt/~pocm 
 ---	
	Yes, God had a deadline...
		So, He wrote it all in Lisp!



Posted on the users mailing list.