Re: scsh vs. scheme48 socket
Immanuel Normann <[email protected]> Thu, 15 Dec 2005 18:46:35 +0100
| Newsgroups | gmane.lisp.scheme.scsh |
|---|---|
| Message-ID | <[email protected]> |
Martin Gasbichler wrote: >Immanuel Normann <[email protected]> writes: > > > >>from the scheme48 manual I constructed a well working pattern how to >>communicate with some server over some socket: >> >> >> >> >>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.) >> >> > >The scsh network API is totally independent of the S48 network API and >also more complete than its S48 counterpart. > > The scsh network API is certainly more complete, but for a socket non-expert as I am the S48 network API is much simpler. >Could you please post the scsh program as well as the error message >you get? > > Take it simply as it is: > ,open sockets extended-ports > (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) (let ((answer (make-string-input-port in))) ; returns any server response into some string (close-input-port in) answer)))) > (ask-server "something" 8080) If you have some socket server running on port 8080 which understands the request "something" and returns anything, but with a delay of say 1 sec. then scsh simply hangs without any error message. Unfortunately I can't provide the server code since it is some third party service (Note it doesn't cause problems when "ask-server" is running under s48 so the external service is not the point). Anyway, how would I solve the task in scsh with its elaborated socket functions? Immanuel