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

Re: am I stupid? I crashed my Mac 10 times with 9 lines of code.

In article <poeck-2508941658440001@wi6a65.informatik.uni-wuerzburg.de>,
poeck@informatik.uni-wuerzburg.de (Karsten Poeck) wrote:

|In article <PHILG.94Aug18131743@camelot.ai.mit.edu>, philg@mit.edu wrote:
|> Remember I said I wanted a function to go out to the network and grab
|4the following gets the same as my unix box
|(require 'mactcp)
|(defun get-http-url (hostname filename)
|  (let ((stream (open-tcp-stream hostname 80))
|        result
|        )
|    (unwind-protect
|      (progn
|        (ccl::telnet-write-line stream (format nil "GET ~a HTTP/1.0" filename))
|        (ccl::telnet-write-line stream "")
|        (setq result (ccl::telnet-read-line stream)))
|      (close stream))
|    result))
|(get-http-url "www-swiss.ai.mit.edu" "/")

FWIW, this gave me error -23005:
> Error: TCP connection closing
> While executing: CCL::%TCP-CONTROL
> Type Command-. to abort.
See the Restarts
 menu item for further choices.
1 > 

on the given home page, as well as a local one.

The backtrace looks something like:

method stream-tyi tcp-stream

The local variables for telnet-read-line seem to indicate that all the
data has been received, ie, the value of ccl::line is what the function
should be returning...

-- "TANSTAAFL"  Rich lynch@ils.nwu.edu