scsh-users
[Top] [All Lists]

Re: scsh vs. scheme48 socket

To: scsh-users@scsh.net
Subject: Re: scsh vs. scheme48 socket
From: Andreas Bernauer <andreas.bernauer@gmx.de>
Date: Tue, 20 Dec 2005 14:21:36 +0100
Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:sender:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=H8bLRlC2q5iKA0adb5xXnmGE3QE//bFqGhNXznnhZfLiOVtEiLnOWAMcIKKNmlRsVRILc9til5GYxBTPS/4UBOrWEnfRIXiV1Cwqjl9wu3xCH3ORa5xMNRH+af3tEOXhOQbnyuJ91sSWfvJznu1JKigRlC/vfTZ2e7of1eA31MI=
List-id: <scsh-users.list-id.scsh.net>
Reply-to: andreas.bernauer@gmx.de
Sender: bernauer@gmail.com
On 12/19/05, Martin Gasbichler <gasbichl@informatik.uni-tuebingen.de> wrote:
> > Anyway, how would I solve the task in scsh with its elaborated socket
> > functions?
>
> Well, just use the first procedure described in the scsh network API:
>

I guess, Martin means something like this:

> (define (ask-server request host-name port-number)
>   (let ((socket (socket-connect protocol-family/internet
>                                 socket-type/stream
>                                 host-name
>                                 port-number)))
>     (display request (socket:outport socket))
     (let ((answer (read-line (socket:inport socket))))
>       (close-socket socket)   ;;; (*)
>       answer)))

(*) Closing the socket like this is not portable across OS (eg. on my
Linux machine this raises an error), but closing the inport is
portable:
(close-input-port (socket:inport socket)
[ see http://www.scsh.net/docu/html/man-Z-H-5.html#node_idx_1002 ]

Immanuel wrote:
> 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).

I tested this on my machine with netcat (nc) listening on some port
and it works fine.  I cannot observe the "hanging" behavior Immanuel
described. Maybe you, Immanuel, can give more details on what you mean
with "hanging"? (You don't mean that scsh is waiting for the input for
1sec., do you?)

Yours,

Andreas.

<Prev in Thread] Current Thread [Next in Thread>