[gambit-list] Tcp server error?

Adrien Piérard pierarda at iro.umontreal.ca
Mon Aug 24 13:45:24 EDT 2009


Left [adrien]/tmp % gsi-gambit tcp.scm
  Right  [adrien]/tmp % telnet 127.0.0.1 20000
  Right  Trying 127.0.0.1...
  Right  Connected to localhost.
  Right  Escape character is '^]'.
  Right  hi
  Right  yea!Connection closed by foreign host.
Left hi


I guess it works.
4.5.1 on FreeBSD (not released yet, I have some last tweaks before
upgrading it in the FreeBSD ports)


However, the client is buggy.
It does not send and EOL character, so the server wants to read more
on the socket.
And then the clients wants to read it too.
Though you flushed, I think that the TCP server, with read, it too
high level to know that it has finished reading the symbol.


P!

2009/8/25 David St-Hilaire <sthilaid at iro.umontreal.ca>:
> Hi all!
>
> Can anyone help me pinpointing what is wrong with the follow tcp server
> code?
>
> (define (tcp-server-test)
>  (let ((p (read (open-tcp-server (list port-number: 20000
> reuse-address: #t)))))
>    (pp (read p))
>    (write 'yea! p)
>    (force-output p)
>    (close-port p)))
>
> (tcp-server-test)
>
> If run this code inside a console and, from another console I run the
> following client code:
>
> (define (tcp-test)
>  (let ((connection
>         (open-tcp-client
>          (list server-address: "192.168.60.239"
>                port-number: 20000))))
>
>    (write 'allo!! connection)
>    (force-output connection)
>    (read connection)
>    (close-port connection)))
>
> (tcp-test)
>
> I always get a "broken pipe" error. Note that the ip address is correct.
> I tried to replace the server with the good old netcat and it works just
> fine (i.e. that the client successfully connects to the nc server). Is
> anything wrong with the server code?
>
> Thanks!
>
> --
> David
> _______________________________________________
> Gambit-list mailing list
> Gambit-list at iro.umontreal.ca
> https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list
>



-- 
Français, English, 日本語, 한국어



More information about the Gambit-list mailing list