Re: Sockets, writing data and shutdownOutput



jan V wrote:
> > > Why don't you socket.shutdownOutput() in your main thread, after you;ve
> > > fully received the web server's response? Why do you have to call it so
> > > early, before having processed the reply?
> >
> > I want to make sure that even the last byte
> > of data gets through to the server and is
> > not lingering somewhere in an output
> > buffer of the client.
>
> That's the job of flush(), not shutdownOutput().

Ok, my explanation was slightly wrong. It is not
the data hanging in a buffer. It is the EOF.

Without shutdownOutput() the server never gets an
EOF while reading the request data. Consequently
it will never issue a close on its outgoing
stream. This results in my clients reader thread
never seeing EOF and so it will keep waiting
for data on the input stream forever.

Should I have mentioned that I am talking about
streaming data. I am not sending fixed sized
chunks back and forth.

Harald.

.



Relevant Pages

  • Re: sscanf question
    ... Input characters are taken from a supplied stdio stream (which is ... (The failure is an "input failure" if fgetc() ... would return EOF on ...
    (comp.lang.c)
  • Re: Deleting characters from opened text files using fopen
    ... You opened the file as a text stream, not as a binary stream, as ... C89 4.9.9.4 The ftell Function ... since EOF is not /, you are going to continue looping. ... A text stream is an ordered sequence of characters composed ...
    (comp.soft-sys.matlab)
  • Re: fgets, EOF in middle of line, does not cause error
    ... As of C99, once EOF is reported for a stdio input stream, ... is set reports EOF without further reading of the file ... regular disk files but, at least on Unix, was not wise ...
    (comp.lang.c)
  • Re: Testing for the EOF on byte streams
    ... You really want "am I just about to hit EOF if I read even one more byte". ... lookahead has already ran off EOF. ... (defun open-file-using-lookahead (name) ... If this were MacLisp you could have produced a funny kind of stream ...
    (comp.lang.lisp)
  • Re: clear-input
    ... >> what does EOF really mean on a socket stream? ... Sockets are unique from other stream devices in that they do not ... In a chunking stream, the chunks are ...
    (comp.lang.lisp)