Hello,
from the scheme48 manual I constructed a well working pattern how to
communicate with some server over some socket:
(define (ask-server request port-number)
(call-with-values
(lambda ()
(socket-client (get-host-name) port-number))
(lambda (in out)
(display request out)
(close-output-port out)
; some time elapses
(let ((answer (read-server-answer in)))
(close-input-port in)
answer))))
Though I can"t find the function "socket-client" in scsh-manual the same
pattern works in principle also under scsh. (Fortunately! Otherwise I
wouldn"t know at all how to solve my task with the scsh socket functions
like: socket-connect, bind-listen-accept-loop, etc.)
However the solution from above works only in principle in scsh (but
reliable in scheme48): Whenever the time elapse between the request to
and response from the server is to long scsh stucks (read-server-answer
is not the problem). Upto now I implemented an unsatisfactory workaround
where I force scsh to wait a fix period of time. But of course scsh
should only wait as long as necessary.
Why does scheme48 wait until the answer comes and why does scsh try to
pick up the answer immediately?
Immanuel
|