From: chedderslam on
How would you do so?

I am trying to get the socket variable created/used by httpd. The
docs have this:
::Httpd$sock
The state of the open connection is stored in global variables,
one per connection. These variables are arrays and have the prefix
Httpd. Their distinguishing suffix is the handle of the channel
(socket) they belong to. This means that any user code which has a
connection handle can import the connection state into its current
scope via a command like

upvar #0 Httpd$sock data

But running the above command results in this:
can't read "sock": no such variable
while executing
"upvar #0 Httpd$sock data"

Thanks.
From: Bryan Oakley on
chedderslam wrote:
> How would you do so?

[info globals]

Optionally, you can supply a pattern. For example: [info globals Http*]
From: Helmut Giese on
On Wed, 18 Jun 2008 09:21:19 -0700 (PDT), chedderslam
<chedderslam(a)gmail.com> wrote:

>I am trying to get the socket variable created/used by httpd. The
>docs have this:
>::Httpd$sock
> The state of the open connection is stored in global variables,
>one per connection. These variables are arrays and have the prefix
>Httpd. Their distinguishing suffix is the handle of the channel
>(socket) they belong to. This means that any user code which has a
>connection handle can import the connection state into its current
>scope via a command like
>
> upvar #0 Httpd$sock data
This assumes
- that the above statement is called inside a proc
- and that this proc receives a parameter named 'sock' which contains
the "connection handle"

Something like
proc doHttpd {sock} {
upvar #0 Httpd$sock data
# your stuff here
....
}

HTH
Helmut Giese
From: Ralf Fassel on
* chedderslam <chedderslam(a)gmail.com>
| This means that any user code which has a connection handle can
| import the connection state into its current scope via a command
| like
| upvar #0 Httpd$sock data

Don't do this unless the httpd code is documented to allow it, or for
debugging purposes. The means how httpd stores the connection data
can change without notice, and code assuming a certain form will fail
miserably. httpd should provide inspection routines for the connecton
data an user might be interested in.

R'
From: yahalom on
On Jun 19, 4:59 am, Ralf Fassel <ralf...(a)gmx.de> wrote:
> * chedderslam <chedders...(a)gmail.com>
> | This means that any user code which has a connection handle can
> | import the connection state into its current scope via a command
> | like
> |       upvar #0 Httpd$sock data
>
> Don't do this unless the httpd code is documented to allow it, or for
> debugging purposes.  The means how httpd stores the connection data
> can change without notice, and code assuming a certain form will fail
> miserably.  httpd should provide inspection routines for the connecton
> data an user might be interested in.
>
> R'

as tclhttpd development is stalled you can safely do it :-). also if
tclhttpd change and you decide to upgrade it you can change the code.
upgrading the web server is a major change that should be done in
controled way.