Hello all,

  I had an issue with a program recently where I tried to write to a socket 
that 
had been shutdown for transmission. This ends up causing guile to halt without 
any warning - no exceptions or backtrace available that I can see. I am using 
guile compiled from master, but get the same results with 1.8.7. Is it correct 
to assume that I should be able to catch an exception under this circumstance? 


Hope a boiled down example inline is ok:

;;;;;;;;;;;;;;;;;;;;

(define (get-addr hostname)
  (let ((host (gethostbyname hostname)))
    (car (hostent:addr-list host))))

(catch #t
  (lambda ()
    (let ((remote (socket PF_INET SOCK_STREAM 0)) (hostname "www.gnu.org"))
      (connect remote AF_INET (get-addr hostname) 80)
      (display (string-append "GET / HTTP/1.0\r\nHost: " hostname "\r\n\r\n") 
remote)
      (display "Sent request...\n")
      (shutdown remote 1)
      (display "Shutdown socket for sending...\n")
      (display "oops, socket is shutdown for sending...\n" remote)
      (shutdown remote 0)
      (display "Shutdown socket for receiving...\n")
      (close remote)))
  (lambda (key . args)
    (display "Caught exception...\n")
    (display key)(newline)
    (display args)(newline)))

(display "Done.\n")

;;;;;;;;;;;;;;;;;;;;

Thanks,

Jon



      

Reply via email to