We seem to be able to write happily to a connchan channel directly using a
string representation as follows eg.

 ns_connchan write $to "HTTP/1.0 504 Gateway Timout\r\n\r\n"

This is a guess, but could you be forcing an implicit type conversion of
your string by manipulating it with non-bytearray aware commands?

eg.

if { $content ne "" } {
will force an internal string representation of $content

but
if { [string length $content] > 0 } {
will not


On 7 April 2017 at 10:06, Wolfgang Winkler <wolfgang.winkler@digital-conc
epts.com> wrote:

> I'm trying to write out html code or javascript code fragments to show the
> progress of the operations.
>
> Am 2017-04-07 um 10:57 schrieb David Osborne:
>
> Re the first issue, I only have experience of ns_connchan but I believe
> the situation is the same.
> You can specify r,w,e, or x for the *argument* ?when? upon creation of the
> callback, but the callback will be triggered upon timeout with a  *value*
> of $when = "t" regardless of what you specify as the argument when setting
> up the callback.
>
> "The optional argument *when* can consist of one or more characters of r,
> w, e, or x, specifying, when the callback should fire. "
>
> Re the binary problem, What is it you are writing to the channel?
>
> On 7 April 2017 at 08:43, Wolfgang Winkler <wolfgang.winkler@digital-conc
> epts.com> wrote:
>
>> Hi!
>>
>> We have some long running scripts, e.g. shrinking of large PDF files, and
>> want to prevent reverse proxy and browser timeouts.
>>
>> To achieve this, we are trying to periodically send small packages from
>> the server to the browser while these scripts are running.
>>
>> First we tried with ns_conn and ns_sockcallback
>>
>> set mychan [ns_conn channel]
>>
>> ns_sockcallback $mychan noop t 1
>>
>> proc noop {handle when} {
>>   # do something
>> }
>>
>> ns_chan close $mychan
>>
>> When we call this, we get the following error:
>>
>> error invalid when specification "t": should be one/more of r, w, e, or x
>>
>> which contradicts the documentation of the command here:
>>
>> https://naviserver.sourceforge.io/n/naviserver/files/ns_sockcallback.html
>>
>> Then we tried something similiar with ns_connchan
>>
>> set mychan [ns_connchan detach]
>>
>> ns_connchan callback -timeout 1 $mychan noop "r"
>>
>> but a ns_connchan write $mychan throws the following error:
>>
>> ns_connchan: only binary channels are currently supported. Channel conn0
>> is not binary
>>
>> Is there a solution to this problem?
>>
>> regards,
>>
>> Wolfgang
>>
>> --
>>
>> *Wolfgang Winkler*
>> Geschäftsführung
>> wolfgang.wink...@digital-concepts.com
>> mobil +43.699.19971172 <+43%20699%2019971172>
>>
>> dc:*büro*
>> digital concepts Novak Winkler OG
>> Software & Design
>> Landstraße 68, 5. Stock, 4020 Linz
>> www.digital-concepts.com
>> tel +43.732.997117.72
>> tel +43.699.1997117.2
>>
>> Firmenbuchnummer: 192003h
>> Firmenbuchgericht: Landesgericht Linz
>>
>>
>>
>> ------------------------------------------------------------
>> ------------------
>> Check out the vibrant tech community on one of the world's most
>> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>> _______________________________________________
>> naviserver-devel mailing list
>> naviserver-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/naviserver-devel
>>
>>
>
>
> --
> David Osborne
> Qcode Software Limited
> http://www.qcode.co.uk
> T: +44 (0)1463 896484 <01463%20896484>
>
>
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>
>
>
> _______________________________________________
> naviserver-devel mailing 
> listnaviserver-devel@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/naviserver-devel
>
>
> --
>
> *Wolfgang Winkler*
> Geschäftsführung
> wolfgang.wink...@digital-concepts.com
> mobil +43.699.19971172 <+43%20699%2019971172>
>
> dc:*büro*
> digital concepts Novak Winkler OG
> Software & Design
> Landstraße 68, 5. Stock, 4020 Linz
> www.digital-concepts.com
> tel +43.732.997117.72
> tel +43.699.1997117.2
>
> Firmenbuchnummer: 192003h
> Firmenbuchgericht: Landesgericht Linz
>
>
>
> ------------------------------------------------------------
> ------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> naviserver-devel mailing list
> naviserver-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/naviserver-devel
>
>


-- 
David Osborne
Qcode Software Limited
http://www.qcode.co.uk
T: +44 (0)1463 896484 <01463%20896484>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel

Reply via email to