[gambit-list] newbie question: output from one port as input to another port

Samuel Montgomery-Blinn sam at caveman.org
Sat Mar 11 22:40:09 EST 2006


So, I have been trying to learn Gambit-C's port mechanisms. This is 
likely an infantile question, but it seems that it should be the most 
basic thing to be able to take one input port and "connect" it to an 
output port. The specific use for me is sending the contents of a file 
over a network (tcp) port. I have tried a few methods, mostly "busy" and 
likely lossy methods.

1. read the entire contents of the file port, then output the file to 
the network port. (wastes time in which earlier parts of the file could 
be written to the network port)
2. read a line from the file port, and output the line to the network 
port. repeat until eof. (wastes time for many reasons)

I was guessing that something to do with the procedures 
"call-with-input-file" or "with-output-to-file" might be something 
towards what might be most succinctly expressed as some sort of UNIX 
"sendfile" functionality, but as I am new both to Scheme (or any Lisp 
for that matter) and Gambit-C, I thought I would both say "hello" to 
this list and ask for its help and guidance. If this sort of question is 
not a faux pas, I certainly have more!

-Sam



More information about the Gambit-list mailing list