unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* Problems with running Network Socket Examples
@ 2023-11-26 20:59 Erik Grun
  2023-12-10 12:44 ` tomas
  0 siblings, 1 reply; 3+ messages in thread
From: Erik Grun @ 2023-11-26 20:59 UTC (permalink / raw)
  To: guile-devel


[-- Attachment #1.1.1: Type: text/plain, Size: 2431 bytes --]

Hello, Guile-Devel,

I just can't get the Network Socket Examples[1] to work. I am using 
Guile 3.0.7.

An obvious mistake seems to be, that the docs use different ports for 
client (80) and server (2904), but even if I use the same port (2904), I 
only get this error message:

Backtrace:
In ice-9/boot-9.scm:
    1752:10  6 (with-exception-handler _ _ #:unwind? _ # _)
In unknown file:
             5 (apply-smob/0 #<thunk 7f5e06560f60>)
In ice-9/boot-9.scm:
      724:2  4 (call-with-prompt _ _ #<procedure default-prompt-handle…>)
In ice-9/eval.scm:
      619:8  3 (_ #(#(#<directory (guile-user) 7f5e06559c80>)))
In ice-9/boot-9.scm:
     2835:4  2 (save-module-excursion _)
    4380:12  1 (_)
In /home/egnun/client.scm:
       7:14  0 (_)

/home/egnun/client.scm:7:14: Unbound variable: read-line

After some research I found out, that I need to include this line.
      (use-modules (ice-9 rdelim))
When I do that, it seems to kinda work?

Hello client
Backtrace:
In ice-9/boot-9.scm:
    1752:10  8 (with-exception-handler _ _ #:unwind? _ # _)
In unknown file:
             7 (apply-smob/0 #<thunk 7f01f1220f60>)
In ice-9/boot-9.scm:
      724:2  6 (call-with-prompt _ _ #<procedure default-prompt-handle…>)
In ice-9/eval.scm:
      619:8  5 (_ #(#(#<directory (guile-user) 7f01f1219c80>)))
In ice-9/boot-9.scm:
     2835:4  4 (save-module-excursion _)
    4380:12  3 (_)
In /home/egnun/client.scm:
       7:27  2 (_)
In ice-9/rdelim.scm:
     195:24  1 (read-line _ _)
In unknown file:
             0 (%read-line #<input-output: socket 5>)

ERROR: In procedure %read-line:
In procedure fport_read: Connection was reset by peer

Before I file a bug, could someone please help me figure out a solution?

Best regards,

Erik (egnun)

[1] 
https://www.gnu.org/software/guile/docs/docs-2.0/guile-ref/Internet-Socket-Examples.html#Internet-Socket-Examples

-- 
pub   rsa4096/C02662E2370D6F27 2016-05-27 [SCA] [verfällt: 2024-05-01]
    Schl.-Fingerabdruck = 7E0E 8A9E EAEE 075D E689  F32F C026 62E2 370D 6F27
uid              [ ultimativ ] Erik Grun <egnun@posteo.de>
uid              [ ultimativ ] Erik Grun <egnun@fsfe.org>
sub   rsa4096/1DF94895FA78155E 2016-05-27 [E] [verfällt: 2024-05-01]

You are wondering, what this signature means?
Visit *emailselfdefense.fsf.org/en/infographic.html*
to find out how YOU can securely encrypt your e-mails.

[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 8889 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Problems with running Network Socket Examples
  2023-11-26 20:59 Problems with running Network Socket Examples Erik Grun
@ 2023-12-10 12:44 ` tomas
  2023-12-29  7:49   ` Erik Grun
  0 siblings, 1 reply; 3+ messages in thread
From: tomas @ 2023-12-10 12:44 UTC (permalink / raw)
  To: Erik Grun; +Cc: guile-devel

[-- Attachment #1: Type: text/plain, Size: 1837 bytes --]

On Sun, Nov 26, 2023 at 09:59:58PM +0100, Erik Grun wrote:
> Hello, Guile-Devel,
> 
> I just can't get the Network Socket Examples[1] to work. I am using Guile
> 3.0.7.
> 
> An obvious mistake seems to be, that the docs use different ports for client
> (80) and server (2904), but even if I use the same port (2904), I only get
> this error message:
> 
> Backtrace:
> In ice-9/boot-9.scm:
>    1752:10  6 (with-exception-handler _ _ #:unwind? _ # _)
> In unknown file:
>             5 (apply-smob/0 #<thunk 7f5e06560f60>)
> In ice-9/boot-9.scm:
>      724:2  4 (call-with-prompt _ _ #<procedure default-prompt-handle…>)
> In ice-9/eval.scm:
>      619:8  3 (_ #(#(#<directory (guile-user) 7f5e06559c80>)))
> In ice-9/boot-9.scm:
>     2835:4  2 (save-module-excursion _)
>    4380:12  1 (_)
> In /home/egnun/client.scm:
>       7:14  0 (_)
> 
> /home/egnun/client.scm:7:14: Unbound variable: read-line
> 
> After some research I found out, that I need to include this line.
>      (use-modules (ice-9 rdelim))

Yes, I'd consider both of the above as downright doc bugs: the missing
of (ice-9 rdelim) in the client code and letting the client aim at a
different port the server is set up to listen to.

As for the third...

> When I do that, it seems to kinda work?
> 
> Hello client
> Backtrace:

[...]

> ERROR: In procedure %read-line:
> In procedure fport_read: Connection was reset by peer

... it is working "as it is supposed to": the server closes the
connection after sending the reply -- the client isn't set up
to expect this and complains (note that it dutifully prints the
server's answer "Hello client" before).

So this one is confusing, but we'd need a bit more of discussion
on how to "fix" it without complicating the examples too much.

Ideas?

Cheers
-- 
t

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Problems with running Network Socket Examples
  2023-12-10 12:44 ` tomas
@ 2023-12-29  7:49   ` Erik Grun
  0 siblings, 0 replies; 3+ messages in thread
From: Erik Grun @ 2023-12-29  7:49 UTC (permalink / raw)
  To: guile-devel


[-- Attachment #1.1.1: Type: text/plain, Size: 3021 bytes --]

Hello,

Am 10.12.23 um 13:44 schrieb tomas@tuxteam.de:
 > On Sun, Nov 26, 2023 at 09:59:58PM +0100, Erik Grun wrote:
 >> Hello, Guile-Devel,
 >>
 >> I just can't get the Network Socket Examples[1] to work. I am using 
Guile
 >> 3.0.7.
 >>
 >> An obvious mistake seems to be, that the docs use different ports 
for client
 >> (80) and server (2904), but even if I use the same port (2904), I 
only get
 >> this error message:
 >>
 >> Backtrace:
 >> In ice-9/boot-9.scm:
 >>     1752:10  6 (with-exception-handler _ _ #:unwind? _ # _)
 >> In unknown file:
 >>              5 (apply-smob/0 #<thunk 7f5e06560f60>)
 >> In ice-9/boot-9.scm:
 >>       724:2  4 (call-with-prompt _ _ #<procedure 
default-prompt-handle…>)
 >> In ice-9/eval.scm:
 >>       619:8  3 (_ #(#(#<directory (guile-user) 7f5e06559c80>)))
 >> In ice-9/boot-9.scm:
 >>      2835:4  2 (save-module-excursion _)
 >>     4380:12  1 (_)
 >> In /home/egnun/client.scm:
 >>        7:14  0 (_)
 >>
 >> /home/egnun/client.scm:7:14: Unbound variable: read-line
 >>
 >> After some research I found out, that I need to include this line.
 >>       (use-modules (ice-9 rdelim))
 >
 > Yes, I'd consider both of the above as downright doc bugs: the missing
 > of (ice-9 rdelim) in the client code and letting the client aim at a
 > different port the server is set up to listen to.

Agreed.

 > As for the third...
 >
 >> When I do that, it seems to kinda work?
 >>
 >> Hello client
 >> Backtrace:
 >
 > [...]
 >
 >> ERROR: In procedure %read-line:
 >> In procedure fport_read: Connection was reset by peer
 >
 > ... it is working "as it is supposed to": the server closes the
 > connection after sending the reply -- the client isn't set up
 > to expect this and complains (note that it dutifully prints the
 > server's answer "Hello client" before).

It is working, but not really.
Because the client is also supposed to print this line:
 >  (display "GET / HTTP/1.0\r\n\r\n" s) ; with s being some socket.

Also removing the "(close client)" from the server script, seems to 
resolve the "Connection reset by peer" error (until I Ctrl-C the server).
 > So this one is confusing, but we'd need a bit more of discussion
 > on how to "fix" it without complicating the examples too much.

Definitely.

The errors are also in the current Guile docs. Just if anyone was wondering…

https://www.gnu.org/software/guile/manual/html_node/Internet-Socket-Examples.html

Best regards,

Erik

-- 
pub   rsa4096/C02662E2370D6F27 2016-05-27 [SCA] [verfällt: 2024-05-01]
   Schl.-Fingerabdruck = 7E0E 8A9E EAEE 075D E689  F32F C026 62E2 370D 6F27
uid              [ ultimativ ] Erik Grun <egnun@posteo.de>
uid              [ ultimativ ] Erik Grun <egnun@fsfe.org>
sub   rsa4096/1DF94895FA78155E 2016-05-27 [E] [verfällt: 2024-05-01]

You are wondering, what this signature means?
Visit *emailselfdefense.fsf.org/en/infographic.html*
to find out how YOU can securely encrypt your e-mails.

[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 8887 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-12-29  7:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-26 20:59 Problems with running Network Socket Examples Erik Grun
2023-12-10 12:44 ` tomas
2023-12-29  7:49   ` Erik Grun

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).