title: Why does this work in DrRacket but not in Racket from the console? (R: undefined;)
body: <p>This code tests port connectivity. Why does this work in DrRacket but not in <strong>Racket from the console</strong> or in the <strong>executable</strong> (Racket -> Create Executable...)?</p>
  
  <pre><code>#lang racket
  (require racket/tcp)
  (define (tcp-open? host port)
    (with-handlers ((exn:fail:network? (lambda (e) #f)))
      (define-values (inp outp) (tcp-connect host port))
      (close-input-port inp)
      (close-output-port outp)
      #t))
  </code></pre>
  
  <p>works fine in DrRacket:</p>
  
  <pre><code>Welcome to DrRacket, version 5.3.2 [3m].
  Language: racket [custom]; memory limit: 512 MB.
  &gt; (tcp-open? "www.racket-lang.org" 80)
  #t
  </code></pre>
  
  <p>The error message from the console is:</p>
  
  <pre><code>Welcome to Racket v5.3.2.
  &gt; (require racket/tcp)
  &gt; (define (tcp-open? host port)
    (with-handlers ((exn:fail:network? (lambda (e) #f)))
      (define-values (inp outp) (tcp-connect host port))
      (close-input-port inp)
      (close-output-port outp)
      #t))
  &gt; (tcp-open? "www.racket-lang.org" 80)
  R: undefined;
   cannot reference undefined identifier
    context...:
     C:\Program Files\Racket\collects\racket\private\misc.rkt:87:7
  </code></pre>