chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Chicken-users] process-fork weirdness


From: Ruhi Bloodworth
Subject: [Chicken-users] process-fork weirdness
Date: Wed, 16 Mar 2005 19:51:11 -0600

Hi,

I'm attempting to implement the tcp-echo benchmark. When I run the
following program:

(require 'posix 'tcp)
(define +port+ 4441)
(define (server)
  (define-values (i o) (tcp-accept (tcp-listen +port+)))
  (let loop ()
    (write-char (read-char i) o)
    (unless (eof-object? (peek-char i) )
            (loop))))

(define (client)
  (define-values (i o) (tcp-connect "localhost" +port+))
  (write-line "Good Bye!" o)
  (print (read-line i))
  (close-input-port i)
  (close-output-port o))


(process-fork client)
(server)

I get
; loading echo.scm ...
; loading library posix ...
; loading library tcp ...
Error: can not write to socket
4
"Good Bye!"


and the program does not terminate. changing the last two lines to
(process-fork server)
(client)
fixes the problem.

; loading echo.scm ...
; loading library posix ...
; loading library tcp ...
Good Bye!
#;1>


Any idea why?

Regards,
Ruhi Bloodworth





reply via email to

[Prev in Thread] Current Thread [Next in Thread]