[gambit-list] Tcp server error?

David St-Hilaire sthilaid at iro.umontreal.ca
Mon Aug 24 11:42:51 EDT 2009


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



More information about the Gambit-list mailing list