#3270 [socket -async] and [puts]: Inadequate documentation?

obsolete: 8.4.11
open
3
2006-03-14
2005-10-18
No

What happens if I open a socket with the -async option and then
immediately start writing to the channel? The documentation
mentions what happens when reading (although only in terms of
[gets]). It does have information on how [flush] works, but if I write
a large amount of information, is it possible I might fill up some
buffer? What happens then?

Discussion

  • Andreas Kupries

    Andreas Kupries - 2006-03-14
    • priority: 5 --> 3
     
  • Andreas Kupries

    Andreas Kupries - 2006-03-14

    Logged In: YES
    user_id=75003

    The puts command queues data only until the condition set
    via -buffering is met, and then invokes [flush] internally.
    At that point the description of [flush] takes over.

    By default it flushes when a -buffersize'd number of
    characters have accumulated. Or every line, or always.

    The best way of dealing with -async is to set a handler for
    writable events. It triggers when the connection is open, or
    has positively failed.

     
  • Kristoffer Lawson

    Logged In: YES
    user_id=137542

    Thank you for the response. However, this does not answer my question in all
    totality. What if the write buffer is full but a connection has not yet been made?
    This is not actually answered in the [flush] documentation either. Will an error
    occur if an attempt is made to flush the buffer, but the connection of an -async
    socket has not yet been completed? Or will the buffer be resized while we are
    waiting to connect?

     
  • Andreas Kupries

    Andreas Kupries - 2006-03-15

    Logged In: YES
    user_id=75003

    How about writing a tcl script which tests this ? My guess
    is that you would get an error as there should be no
    open/valid file handle Tcl can actually write to.

    Regarding buffer resizing, the only way to change buffer
    sizes is via fconfigure. The system does no automatic changes.

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks