[Openmcl-devel] Transfer the contents of a file to a tcp stream
chr at nybo.no
Wed Jul 13 12:25:11 EDT 2005
A function written in platform-independent CL barfs at times in
input-file-ioblock-advance. Seems there are times when a read-
sequence returns less than what it's asked
for, and this mismatch is detected by the advance function. I have
tried to narrow this down to an example where we copy the contents of
a file to another file, and set up lots of processes that each have
such a separate task.
With a directory "/Users/chr/Sites/formula/drobak/07-Images/"
containing some images, I can provoke the error by doing the
following. This is with ccl::*MULTIPROCESSING-SOCKET-IO* set to nil,
when it is set to t, similar errors are reported by CCL::OUTPUT-FILE-
(defun stream-file (in out)
"Copy from pathname <in> to pathname <out>."
(with-open-file (is in :element-type '(unsigned-byte 8))
(with-open-file (os out
:element-type '(unsigned-byte 8))
(loop with buffer-size = 2048
with buffer = (make-array buffer-size :element-type
for nread = (read-sequence buffer is)
do (write-sequence buffer os :end nread)
while (= nread buffer-size)))))
(defun stream-file-process (pathname)
(process-run-function (format nil "slave-~A" (pathname-name
#'stream-file pathname (pathname
(format nil "/tmp/foo.~A"
(defun stream-file-process-directory (wild-pathname)
;; this one has trouble in input-file-ioblock-advance
(setf ccl::*MULTIPROCESSING-SOCKET-IO* nil)
;; Could some of you alter *directory-with-certain-files*
;; and report back on whether this works on your systems?
More information about the Openmcl-devel