From scsh-users-request@scsh.net Thu Dec 15 16:46:54 2005 Return-Path: X-Original-To: scsh@informatik.uni-tuebingen.de Delivered-To: scsh@informatik.uni-tuebingen.de Received: from localhost (loopback [127.0.0.1]) by mx4.informatik.uni-tuebingen.de (Postfix) with ESMTP id E3CEC13DC; Thu, 15 Dec 2005 16:46:52 +0100 (NFT) Received: from mx4.informatik.uni-tuebingen.de ([127.0.0.1]) by localhost (mx4 [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 33740-04; Thu, 15 Dec 2005 16:46:46 +0100 (NFT) Received: from www.scsh.net (bernard.Informatik.Uni-Tuebingen.De [134.2.12.122]) by mx4.informatik.uni-tuebingen.de (Postfix) with ESMTP id 5089813DB; Thu, 15 Dec 2005 16:46:44 +0100 (NFT) Received: by www.scsh.net (Postfix, from userid 3123) id EAB825ECC; Thu, 15 Dec 2005 16:46:43 +0100 (MET) Old-Return-Path: X-Original-To: scsh-users@scsh.net Delivered-To: scsh-users@scsh.net From: Immanuel Normann User-Agent: Debian Thunderbird 1.0.2 (X11/20050404) X-Accept-Language: en-us, en To: scsh-users@scsh.net Subject: About separation of layout and logic in sunet surflets Date: Thu, 15 Dec 2005 16:22:56 +0100 (MET) Message-ID: <6zy82mwefy.fsf@informatik.uni-tuebingen.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Resent-Message-ID: <13GCwC.A.IzD.j_YoDB@bernard> Resent-From: scsh-users@scsh.net X-Mailing-List: archive/latest/235 X-Loop: scsh-users@scsh.net List-Post: List-Help: List-Subscribe: List-Unsubscribe: Precedence: list Resent-Sender: scsh-users-request@scsh.net List-Id: List-Archive: Resent-Date: Thu, 15 Dec 2005 16:46:43 +0100 (MET) Hello, I'am just starting to implement a little web application with the sunet server. The documentation and the code examples of surflets are quite helpful, but there are also some limititations: My general objection is that there is no comprehensible separation between logic and layout in the surflets. I mean something like the so called "Modell View Control' design pattern. May be it is just a matter of insufficient documentation in this respect. To give an example: Just by accident (i.e. by scanning some example code) I figured out how to set the width of a text input field with the function make-text-field. But for instance I have no clue how to manipulate layout in the "surflet-form" function. I am not asking for special case problems, I am rather interested in the general concept concerning layout encoding inside the surflet functions. Moreover I have problems with "get-bindings": Appearently I can't use it to retrieve some hardcoded key-value pairs. get-bindings seems to support only generated key-value pairs (e.g. generated by make-text-field). Right now I see only these two alternatives: 1) Use surflet build in functions like surflet-form => unclear how to influence the layout 2) Hardcode html => how do I get bindings? I certainly would appriciate more documentation in this respect. Thanks, Immanuel From scsh-users-request@scsh.net Thu Dec 15 17:04:10 2005 Return-Path: X-Original-To: scsh@informatik.uni-tuebingen.de Delivered-To: scsh@informatik.uni-tuebingen.de Received: from localhost (loopback [127.0.0.1]) by mx1.informatik.uni-tuebingen.de (Postfix) with ESMTP id 74ECE1CA; Thu, 15 Dec 2005 17:04:08 +0100 (NFT) Received: from mx1.informatik.uni-tuebingen.de ([127.0.0.1]) by localhost (mx1 [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 37244-04; Thu, 15 Dec 2005 17:04:06 +0100 (NFT) Received: from www.scsh.net (bernard.Informatik.Uni-Tuebingen.De [134.2.12.122]) by mx1.informatik.uni-tuebingen.de (Postfix) with ESMTP id 6EF98159; Thu, 15 Dec 2005 17:04:05 +0100 (NFT) Received: by www.scsh.net (Postfix, from userid 3123) id 0DAD85ECE; Thu, 15 Dec 2005 17:04:05 +0100 (MET) Old-Return-Path: X-Original-To: scsh-users@scsh.net Delivered-To: scsh-users@scsh.net From: Immanuel Normann User-Agent: Debian Thunderbird 1.0.2 (X11/20050404) X-Accept-Language: en-us, en To: scsh-users@scsh.net Subject: scsh vs. scheme48 socket Date: Thu, 15 Dec 2005 16:59:52 +0100 (MET) Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Resent-Message-ID: Resent-From: scsh-users@scsh.net X-Mailing-List: archive/latest/236 X-Loop: scsh-users@scsh.net List-Post: List-Help: List-Subscribe: List-Unsubscribe: Precedence: list Resent-Sender: scsh-users-request@scsh.net List-Id: List-Archive: Resent-Date: Thu, 15 Dec 2005 17:04:05 +0100 (MET) 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 From scsh-users-request@scsh.net Thu Dec 15 17:09:11 2005 Return-Path: X-Original-To: scsh@informatik.uni-tuebingen.de Delivered-To: scsh@informatik.uni-tuebingen.de Received: from localhost (loopback [127.0.0.1]) by mx4.informatik.uni-tuebingen.de (Postfix) with ESMTP id 4D5291457; Thu, 15 Dec 2005 17:09:09 +0100 (NFT) Received: from mx4.informatik.uni-tuebingen.de ([127.0.0.1]) by localhost (mx4 [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 28348-01; Thu, 15 Dec 2005 17:09:04 +0100 (NFT) Received: from www.scsh.net (bernard.Informatik.Uni-Tuebingen.De [134.2.12.122]) by mx4.informatik.uni-tuebingen.de (Postfix) with ESMTP id 0573113BC; Thu, 15 Dec 2005 17:08:56 +0100 (NFT) Received: by www.scsh.net (Postfix, from userid 3123) id B254F5EC9; Thu, 15 Dec 2005 17:08:55 +0100 (MET) Old-Return-Path: X-Original-To: scsh-users@scsh.net Delivered-To: scsh-users@scsh.net To: Immanuel Normann Cc: scsh-users@scsh.net Subject: Re: scsh vs. scheme48 socket References: From: Martin Gasbichler Date: Thu, 15 Dec 2005 17:08:53 +0100 In-Reply-To: (Immanuel Normann's message of "Thu, 15 Dec 2005 16:59:52 +0100 (MET)") Message-ID: User-Agent: Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.4 (Jumbo Shrimp, berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Resent-Message-ID: Resent-From: scsh-users@scsh.net X-Mailing-List: archive/latest/237 X-Loop: scsh-users@scsh.net List-Post: List-Help: List-Subscribe: List-Unsubscribe: Precedence: list Resent-Sender: scsh-users-request@scsh.net List-Id: List-Archive: Resent-Date: Thu, 15 Dec 2005 17:08:55 +0100 (MET) Immanuel Normann writes: > 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.) The scsh network API is totally independent of the S48 network API and also more complete than its S48 counterpart. > 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? Could you please post the scsh program as well as the error message you get? -- Martin From scsh-users-request@scsh.net Fri Dec 16 23:32:31 2005 Return-Path: X-Original-To: scsh@informatik.uni-tuebingen.de Delivered-To: scsh@informatik.uni-tuebingen.de Received: from localhost (loopback [127.0.0.1]) by mx4.informatik.uni-tuebingen.de (Postfix) with ESMTP id A7BD91094; Fri, 16 Dec 2005 23:32:29 +0100 (NFT) Received: from mx4.informatik.uni-tuebingen.de ([127.0.0.1]) by localhost (mx4 [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 51950-03; Fri, 16 Dec 2005 23:32:22 +0100 (NFT) Received: from www.scsh.net (bernard.Informatik.Uni-Tuebingen.De [134.2.12.122]) by mx4.informatik.uni-tuebingen.de (Postfix) with ESMTP id D8864137E; Fri, 16 Dec 2005 23:32:20 +0100 (NFT) Received: by www.scsh.net (Postfix, from userid 3123) id 8B4435ECE; Fri, 16 Dec 2005 23:32:20 +0100 (MET) Old-Return-Path: X-Original-To: scsh-users@scsh.net Delivered-To: scsh-users@scsh.net 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:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=VIz5Ax7YgQAlNazQeniUHYc6TmcBed8oPRym4ZNOIN/95QArAhw71qmI+UGxLi02T5tYIp+sGaeFdrb6f1UyuveUmh4Y2tHH5JPuN2Pocj8T/jIBQtEzq688Mdwsi1F5sx2AvGJkwJHqmIEXzFMxnul9Epou4c0ML0WGcsYUcs0= Message-ID: Date: Fri, 16 Dec 2005 23:32:16 +0100 From: Andreas Bernauer Reply-To: andreas.bernauer@gmx.de Sender: bernauer@gmail.com To: Immanuel Normann Subject: Re: About separation of layout and logic in sunet surflets Cc: scsh-users@scsh.net In-Reply-To: <6zy82mwefy.fsf@informatik.uni-tuebingen.de> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <6zy82mwefy.fsf@informatik.uni-tuebingen.de> Resent-Message-ID: Resent-From: scsh-users@scsh.net X-Mailing-List: archive/latest/238 X-Loop: scsh-users@scsh.net List-Post: List-Help: List-Subscribe: List-Unsubscribe: Precedence: list Resent-Sender: scsh-users-request@scsh.net List-Id: List-Archive: Resent-Date: Fri, 16 Dec 2005 23:32:20 +0100 (MET) Hi Immanual, On 12/15/05, Immanuel Normann wrote: > My general objection is that there is no comprehensible separation > between logic and layout in the surflets. I mean something like the so > called "Modell View Control' design pattern. May be it is just a matter > of insufficient documentation in this respect. I don't quite understand what you mean with "logic" and "layout": The program flow is very much seperated from the "layout" or "content", that was the basic idea to develop SUrflets. E.g. the names of the input fields ("layout") don't appear in the code ("logic"). And with scheme you can write your simple routines that enter some text or even input-fields in some point of the SXML-tree representing your web page. However, there no such thing as a "Content Manager" where you have your layout structure and just provide the content. Nevertheless, the surflets let you create your own content manager. And I don't know of any other server side scripting system where this could be easier (but maybe I don't know enough server side scripting systems...) > To give an example: > Just by accident (i.e. by scanning some example code) I figured out how > to set the width of a text input field with the function > make-text-field. This is described in the manual at http://www.scsh.net/resources/sunet-manual/man-Z-H-8.html#node_sec_Temp_16 However, I admit that you have to know some HTML to provide the right attributes to make-text-field, or, in general, use the SUrflet functions. [Maybe you already know my favorite source for HTML knowledge (assuming you know German): http://de.selfhtml.org/] > But for instance I have no clue how to manipulate > layout in the "surflet-form" function. I am not asking for special case > problems, I am rather interested in the general concept concerning > layout encoding inside the surflet functions. What do you mean with "layout in the surflet-form function"? Within surflet-form your are free with your layout, aren't you? Or do you mean the attributes you want to provide the input-form? At http://www.scsh.net/resources/sunet-manual/man-Z-H-8.html#node_idx_324 you see that surflet-form accepts HTML-attributes as a parameter, which are inserted into the HTML entity. > Moreover I have problems with "get-bindings": Appearently I can't use it > to retrieve some hardcoded key-value pairs. get-bindings seems to > support only generated key-value pairs (e.g. generated by make-text-field= ). I don't understand what you mean with hardcoded vs. generated key-value pairs. Get-bindings does not know where the key-value pairs come from. It extracts both of them. Here's an example SUrflet that does it: (define-structure surflet surflet-interface (open scheme-with-scsh =09surflets) (begin (define (main req) (let ((bindings (get-bindings req))) =09(display bindings) (newline) ; displays on terminal =09(send-html/finish ; displays in browser =09 `(html (body (p "Bindings were " =09=09=09 ,(format #f "~a" bindings))))))) )) If you call the webpage with http://localhost:8080/surflet/bindings.scm?a=3D2123 you'll get Bindings where ((a . 2123)) as answer. > Right now I see only these two alternatives: > 1) Use surflet build in functions like surflet-form =3D> unclear how to > influence the layout (surflet-form k-url GET '(@ (accept-charset "ISO-8859-1 ISO-8859-2")) *) > 2) Hardcode html =3D> how do I get bindings? with get-bindings and extract-bindings. See example surflet above. > I certainly would appriciate more documentation in this respect. Did you already know the documentation and Howtos at http://www.scsh.net/resources/sunet-manual/man-Z-H-8.html#node_chap_6 ? Hope that helps. If not, please let me know. Yours, Andreas. From scsh-users-request@scsh.net Mon Dec 19 09:09:14 2005 Return-Path: X-Original-To: scsh@informatik.uni-tuebingen.de Delivered-To: scsh@informatik.uni-tuebingen.de Received: from localhost (loopback [127.0.0.1]) by mx1.informatik.uni-tuebingen.de (Postfix) with ESMTP id 22F9C1D2; Mon, 19 Dec 2005 09:09:13 +0100 (NFT) Received: from mx1.informatik.uni-tuebingen.de ([127.0.0.1]) by localhost (mx1 [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 14002-03; Mon, 19 Dec 2005 09:09:10 +0100 (NFT) Received: from www.scsh.net (bernard.Informatik.Uni-Tuebingen.De [134.2.12.122]) by mx1.informatik.uni-tuebingen.de (Postfix) with ESMTP id 5494C1D1; Mon, 19 Dec 2005 09:09:09 +0100 (NFT) Received: by www.scsh.net (Postfix, from userid 3123) id 1C3285ECE; Mon, 19 Dec 2005 09:09:09 +0100 (MET) Old-Return-Path: X-Original-To: scsh-users@scsh.net Delivered-To: scsh-users@scsh.net To: Immanuel Normann Cc: scsh-users@scsh.net Subject: Re: scsh vs. scheme48 socket References: <43A1ABFB.4090305@iu-bremen.de> From: Martin Gasbichler Date: Mon, 19 Dec 2005 09:09:07 +0100 In-Reply-To: <43A1ABFB.4090305@iu-bremen.de> (Immanuel Normann's message of "Thu, 15 Dec 2005 18:46:35 +0100") Message-ID: User-Agent: Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.4 (Jumbo Shrimp, berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Resent-Message-ID: Resent-From: scsh-users@scsh.net X-Mailing-List: archive/latest/239 X-Loop: scsh-users@scsh.net List-Post: List-Help: List-Subscribe: List-Unsubscribe: Precedence: list Resent-Sender: scsh-users-request@scsh.net List-Id: List-Archive: Resent-Date: Mon, 19 Dec 2005 09:09:09 +0100 (MET) Immanuel Normann writes: > Martin Gasbichler wrote: > >>Immanuel Normann writes: > >>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) Ah, so you're using the S48-API within scsh. The problems you see are maybe due to bugs in the S48 version that scsh is based on. > 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: (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)) ;; maybe you have to add NEWLINE here (let ((answer (make-string-input-port (socket:inport socket)))) (close-socket socket) answer))) [Untested code] -- Martin From scsh-users-request@scsh.net Mon Dec 19 09:11:45 2005 Return-Path: X-Original-To: scsh@informatik.uni-tuebingen.de Delivered-To: scsh@informatik.uni-tuebingen.de Received: from localhost (loopback [127.0.0.1]) by mx1.informatik.uni-tuebingen.de (Postfix) with ESMTP id 4A4981D2; Mon, 19 Dec 2005 09:11:44 +0100 (NFT) Received: from mx1.informatik.uni-tuebingen.de ([127.0.0.1]) by localhost (mx1 [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 14004-01; Mon, 19 Dec 2005 09:11:42 +0100 (NFT) Received: from www.scsh.net (bernard.Informatik.Uni-Tuebingen.De [134.2.12.122]) by mx1.informatik.uni-tuebingen.de (Postfix) with ESMTP id 790B411F; Mon, 19 Dec 2005 09:11:41 +0100 (NFT) Received: by www.scsh.net (Postfix, from userid 3123) id 321E45EC9; Mon, 19 Dec 2005 09:11:41 +0100 (MET) Old-Return-Path: X-Original-To: scsh-users@scsh.net Delivered-To: scsh-users@scsh.net Date: Thu, 15 Dec 2005 18:46:35 +0100 From: Immanuel Normann User-Agent: Debian Thunderbird 1.0.2 (X11/20050404) X-Accept-Language: en-us, en To: Martin Gasbichler Cc: scsh-users@scsh.net Subject: Re: scsh vs. scheme48 socket References: In-Reply-To: Message-ID: <36acexv745.fsf@informatik.uni-tuebingen.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Resent-Message-ID: Resent-From: scsh-users@scsh.net X-Mailing-List: archive/latest/240 X-Loop: scsh-users@scsh.net List-Post: List-Help: List-Subscribe: List-Unsubscribe: Precedence: list Resent-Sender: scsh-users-request@scsh.net List-Id: List-Archive: Resent-Date: Mon, 19 Dec 2005 09:11:41 +0100 (MET) Martin Gasbichler wrote: >Immanuel Normann 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 From scsh-users-request@scsh.net Tue Dec 20 14:21:47 2005 Return-Path: X-Original-To: scsh@informatik.uni-tuebingen.de Delivered-To: scsh@informatik.uni-tuebingen.de Received: from localhost (loopback [127.0.0.1]) by mx4.informatik.uni-tuebingen.de (Postfix) with ESMTP id CDB151405; Tue, 20 Dec 2005 14:21:45 +0100 (NFT) Received: from mx4.informatik.uni-tuebingen.de ([127.0.0.1]) by localhost (mx4 [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 39134-02; Tue, 20 Dec 2005 14:21:42 +0100 (NFT) Received: from www.scsh.net (bernard.Informatik.Uni-Tuebingen.De [134.2.12.122]) by mx4.informatik.uni-tuebingen.de (Postfix) with ESMTP id C75EF13F3; Tue, 20 Dec 2005 14:21:40 +0100 (NFT) Received: by www.scsh.net (Postfix, from userid 3123) id 702AC5ECE; Tue, 20 Dec 2005 14:21:40 +0100 (MET) Old-Return-Path: X-Original-To: scsh-users@scsh.net Delivered-To: scsh-users@scsh.net 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= Message-ID: Date: Tue, 20 Dec 2005 14:21:36 +0100 From: Andreas Bernauer Reply-To: andreas.bernauer@gmx.de Sender: bernauer@gmail.com To: scsh-users@scsh.net Subject: Re: scsh vs. scheme48 socket In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <43A1ABFB.4090305@iu-bremen.de> Resent-Message-ID: Resent-From: scsh-users@scsh.net X-Mailing-List: archive/latest/241 X-Loop: scsh-users@scsh.net List-Post: List-Help: List-Subscribe: List-Unsubscribe: Precedence: list Resent-Sender: scsh-users-request@scsh.net List-Id: List-Archive: Resent-Date: Tue, 20 Dec 2005 14:21:40 +0100 (MET) On 12/19/05, Martin Gasbichler 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.