[Openmcl-devel] Trouble writing to tcp socket

Gary Byers gb at clozure.com
Sat Nov 15 11:00:34 PST 2014


A "fully buffered" stream doesn't automatically call something like  
FORCE-OUTPUT for you (or, more likely, only does so when some internal  
buffer is full.)   Some other widely-used conventions are  
"line-buffering" (FORCE-OUTPUT is called whenever a newline is written  
to the stream) and "character-buffering" (FORCE-OUTPUT is called  
whenever any character is written to the stream.)


On 11/15/2014 08:58:58 AM, Joshua Kordani wrote:
> On 11/15/14 1:38 AM, Gary Byers wrote:
>> On 11/14/2014 09:44:35 PM, Joshua Kordani wrote:
>>> http://paste.lisp.org/display/144373#1
>>> 
>>> Even with the annotate, I can't write out to the socket.   
>>> http-client returns nil, and in wireshark I see no packets on the  
>>> wire.  I am using a netcat listener as a test server, and the read  
>>> function works just fine, but writing does not.  I have tried this  
>>> on the latest trunk and also on relesae 1.9, both on osx 10.7 and I  
>>> get the same result, that is, nothing is written out on the wire as  
>>> a result of write functions called on this stream.
>>> 
>>> Am I missing something obvious or should I file a bug report?
>> 
>> You're missing something obvious.
>> 
>> FORCE-OUTPUT and FINISH-OUTPUT each take optional arguments which  
>> specify what output stream they affect; this argument defaults to  
>> the stream which is the value of *STANDARD-OUTPUT*, and this likely  
>> isn't what you want.  In your example, calling either
>> 
>> (FORCE-OUTPUT OS)
>> 
>> or
>> 
>> (FINISH-OUTPUT OS)
>> 
>> will cause any data in the stream's buffers to be sent to the OS.   
>> (There was a discussion of the differences between these functions  
>> on this list a week or two ago; I don't want to repeat that, but I  
>> think that in most cases FORCE-OUTPUT suffices.)
>> 
>> Streams in CCL are almost always fully buffered.
>> 
>>> Thanks.
>>> 
>>> --
>>> Joshua Kordani
>>> LSA Autonomy
>>> _______________________________________________
>>> Openmcl-devel mailing list
>>> Openmcl-devel at clozure.com
>>> https://lists.clozure.com/mailman/listinfo/openmcl-devel
>>> 
> 
> Thanks Gary,
> 
> Don't know why I didn't put 2 and 2 together, I recognized that I'd  
> need to pass my stream to all the stream write functions, but not the  
> force/finish output calls...  Btw, what do you mean when you say  
> "fully" buffered?
> 
> Thanks again.
> 
> Joshua Kordani
> LSA Autonomy
> 



More information about the Openmcl-devel mailing list