Socket problem

Jim Blandy (jimb@red-bean.com)
Tue, 26 Aug 1997 18:45:13 -0500

The `accept' function returns a pair: (SOCKET . ADDRESS); you want to
write the string to the SOCKET. So you need to take the CAR of the
value returned by `accept'.

>Guile list,
>
>When I run
>
> (let ((lsock (socket AF_INET SOCK_STREAM 0)))
> (bind lsock AF_INET INADDR_ANY 4242)
> (listen lsock 5)
> (let ((csock (accept lsock)))
> (display "foo" csock)
> (close csock)))
>
>and telnet to port 4242, guile barfs with the following error:
>
> ERROR: In procedure display in expression (display "foo" csock):
> ERROR: Wrong type argument in position 2: (#<input: output: file 5> . #(2 2180006087 2752))
> ABORT: (wrong-type-arg)
>
>Ideas? Thanks.