Rocksolid Light

Welcome to Rocksolid Light

mail  files  register  newsreader  groups  login

Message-ID:  

If it has syntax, it isn't user friendly.


devel / comp.lang.tcl / Re: Tclhttpd not working on ports

SubjectAuthor
* Tclhttpd not working on portsShaun Kulesa
+* Tclhttpd not working on portsPeter Dean
|`* Tclhttpd not working on portsShaun Kulesa
| `* Tclhttpd not working on portsPeter Dean
|  `- Tclhttpd not working on portsPeter Dean
+* Tclhttpd not working on portsRich
|`- Tclhttpd not working on portsShaun Kulesa
`- Tclhttpd not working on portsDanilo Chang

1
Tclhttpd not working on ports

<1407fb03-8b00-4199-be11-4b946b114592n@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=12739&group=comp.lang.tcl#12739

  copy link   Newsgroups: comp.lang.tcl
X-Received: by 2002:a0c:d6ca:0:b0:670:f2a1:a0a0 with SMTP id l10-20020a0cd6ca000000b00670f2a1a0a0mr22666qvi.12.1699443148855;
Wed, 08 Nov 2023 03:32:28 -0800 (PST)
X-Received: by 2002:a9d:5e82:0:b0:6b8:6cec:b73e with SMTP id
f2-20020a9d5e82000000b006b86cecb73emr406563otl.5.1699443148608; Wed, 08 Nov
2023 03:32:28 -0800 (PST)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.tcl
Date: Wed, 8 Nov 2023 03:32:28 -0800 (PST)
Injection-Info: google-groups.googlegroups.com; posting-host=139.222.233.73; posting-account=Be2r4goAAACg4Ko_BkJ0V-RlkGAdXGng
NNTP-Posting-Host: 139.222.233.73
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <1407fb03-8b00-4199-be11-4b946b114592n@googlegroups.com>
Subject: Tclhttpd not working on ports
From: shaunkulesa@gmail.com (Shaun Kulesa)
Injection-Date: Wed, 08 Nov 2023 11:32:28 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 2049
 by: Shaun Kulesa - Wed, 8 Nov 2023 11:32 UTC

I'm trying to run the tclhttpd web server example but every port I try on my university wifi or my remote linux virtual machine it will say the port is already in use.

couldn't open socket: address already in use
while executing
"socket -server [namespace code [list my connect]] -myaddr $ip $port"
(class "::httpd::server" method "start" line 20)
invoked from within
"HTTPD start"

I then try the python http server on the same port afterwards and it works.

package require httpd

httpd::server create HTTPD port 8039

HTTPD start

# Add in a dict based dispatcher
HTTPD plugin dispatch ::httpd::plugin.dict_dispatch
# Register the /hello uri to be answered by our new class
HTTPD uri add * /hello {mixin {content reply.hello}}

oo::class create ::reply.hello {
method content {} {
my puts "<HTML><HEAD><TITLE>My Example Server</TITLE></HEAD><BODY>"
my puts "<h1>Hello World!</h1>"
my puts "Nice to see you from [my request get REMOTE_HOST]"
my puts "The time is now [clock format [clock seconds]]"
my puts </BODY></HTML>
}
}

Re: Tclhttpd not working on ports

<uigv4n$1pv5m$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=12767&group=comp.lang.tcl#12767

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!news.neodome.net!usenet.network!eternal-september.org!feeder2.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: peterd@nospam.net (Peter Dean)
Newsgroups: comp.lang.tcl
Subject: Re: Tclhttpd not working on ports
Date: Thu, 9 Nov 2023 07:38:30 +1000
Organization: A noiseless patient Spider
Lines: 35
Message-ID: <uigv4n$1pv5m$1@dont-email.me>
References: <1407fb03-8b00-4199-be11-4b946b114592n@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 8 Nov 2023 21:38:31 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="197cfb2c5047c664b0c77b92ca5ea458";
logging-data="1899702"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/WzKWISiwNRnCl+GzFGi8x"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:q/Bz4D91Y9wW5tysSGZTLx1eAT4=
Content-Language: en-AU
In-Reply-To: <1407fb03-8b00-4199-be11-4b946b114592n@googlegroups.com>
 by: Peter Dean - Wed, 8 Nov 2023 21:38 UTC

On 8/11/23 21:32, Shaun Kulesa wrote:
> I'm trying to run the tclhttpd web server example but every port I try on my university wifi or my remote linux virtual machine it will say the port is already in use.
>
> couldn't open socket: address already in use
> while executing
> "socket -server [namespace code [list my connect]] -myaddr $ip $port"
> (class "::httpd::server" method "start" line 20)
> invoked from within
> "HTTPD start"
>
> I then try the python http server on the same port afterwards and it works.
>
> package require httpd
>
> httpd::server create HTTPD port 8039
>
> HTTPD start
>
> # Add in a dict based dispatcher
> HTTPD plugin dispatch ::httpd::plugin.dict_dispatch
> # Register the /hello uri to be answered by our new class
> HTTPD uri add * /hello {mixin {content reply.hello}}
>
> oo::class create ::reply.hello {
> method content {} {
> my puts "<HTML><HEAD><TITLE>My Example Server</TITLE></HEAD><BODY>"
> my puts "<h1>Hello World!</h1>"
> my puts "Nice to see you from [my request get REMOTE_HOST]"
> my puts "The time is now [clock format [clock seconds]]"
> my puts </BODY></HTML>
> }
> }
what version of tclhttpd?
Is it this?
fossil clone https://core.tcl-lang.org/tclhttpd

Re: Tclhttpd not working on ports

<9857f9d9-7588-4216-89ee-c3e189498dbcn@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=12768&group=comp.lang.tcl#12768

  copy link   Newsgroups: comp.lang.tcl
X-Received: by 2002:a05:620a:1a9f:b0:775:77a4:876c with SMTP id bl31-20020a05620a1a9f00b0077577a4876cmr115440qkb.4.1699519372148;
Thu, 09 Nov 2023 00:42:52 -0800 (PST)
X-Received: by 2002:ac8:1490:0:b0:419:cb89:f4e2 with SMTP id
l16-20020ac81490000000b00419cb89f4e2mr183952qtj.3.1699519371852; Thu, 09 Nov
2023 00:42:51 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.tcl
Date: Thu, 9 Nov 2023 00:42:51 -0800 (PST)
In-Reply-To: <uigv4n$1pv5m$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=139.222.233.73; posting-account=Be2r4goAAACg4Ko_BkJ0V-RlkGAdXGng
NNTP-Posting-Host: 139.222.233.73
References: <1407fb03-8b00-4199-be11-4b946b114592n@googlegroups.com> <uigv4n$1pv5m$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <9857f9d9-7588-4216-89ee-c3e189498dbcn@googlegroups.com>
Subject: Re: Tclhttpd not working on ports
From: shaunkulesa@gmail.com (Shaun Kulesa)
Injection-Date: Thu, 09 Nov 2023 08:42:52 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 1223
 by: Shaun Kulesa - Thu, 9 Nov 2023 08:42 UTC

Hi,

I am 99% sure my versions are from the tcllib, the version numbers are 4.3.4 and 4.3.5.

Re: Tclhttpd not working on ports

<uiji75$2cs9o$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=12773&group=comp.lang.tcl#12773

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder2.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: peterd@nospam.net (Peter Dean)
Newsgroups: comp.lang.tcl
Subject: Re: Tclhttpd not working on ports
Date: Fri, 10 Nov 2023 07:16:21 +1000
Organization: A noiseless patient Spider
Lines: 16
Message-ID: <uiji75$2cs9o$1@dont-email.me>
References: <1407fb03-8b00-4199-be11-4b946b114592n@googlegroups.com>
<uigv4n$1pv5m$1@dont-email.me>
<9857f9d9-7588-4216-89ee-c3e189498dbcn@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 9 Nov 2023 21:16:22 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="8b62141201a4776aa6d44ec618de196d";
logging-data="2519352"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1898xa6gdQkuA3DpSjdAYCc"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:ybYgHbjtN19ks+z4M2Bcfny7TTc=
In-Reply-To: <9857f9d9-7588-4216-89ee-c3e189498dbcn@googlegroups.com>
Content-Language: en-AU
 by: Peter Dean - Thu, 9 Nov 2023 21:16 UTC

On 9/11/23 18:42, Shaun Kulesa wrote:
> Hi,
>
> I am 99% sure my versions are from the tcllib, the version numbers are 4.3.4 and 4.3.5.

hmm I don't see it in tcllib
https://core.tcl-lang.org/tcllib/doc/trunk/embedded/md/toc.md

nor do I see those in tclhttpd branch list
https://core.tcl-lang.org/tclhttpd/brlist

neither is the wiki page any help
https://wiki.tcl-lang.org/page/TclHttpd

what am I missing?

Re: Tclhttpd not working on ports

<uijk98$2df3l$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=12774&group=comp.lang.tcl#12774

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder2.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: peter@invalid.org (Peter Dean)
Newsgroups: comp.lang.tcl
Subject: Re: Tclhttpd not working on ports
Date: Fri, 10 Nov 2023 07:51:35 +1000
Organization: A noiseless patient Spider
Lines: 20
Message-ID: <uijk98$2df3l$1@dont-email.me>
References: <1407fb03-8b00-4199-be11-4b946b114592n@googlegroups.com>
<uigv4n$1pv5m$1@dont-email.me>
<9857f9d9-7588-4216-89ee-c3e189498dbcn@googlegroups.com>
<uiji75$2cs9o$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 9 Nov 2023 21:51:36 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="8b62141201a4776aa6d44ec618de196d";
logging-data="2538613"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18qGKux7ub8vL/LVdMBmemF"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:OlJSlplnTADxFAsuROoRYDucS+c=
In-Reply-To: <uiji75$2cs9o$1@dont-email.me>
Content-Language: en-US
 by: Peter Dean - Thu, 9 Nov 2023 21:51 UTC

On 10/11/23 07:16, Peter Dean wrote:
> On 9/11/23 18:42, Shaun Kulesa wrote:
>> Hi,
>>
>> I am 99% sure my versions are from the tcllib, the version numbers are
>> 4.3.4 and 4.3.5.
>
>
> hmm I don't see it in tcllib
> https://core.tcl-lang.org/tcllib/doc/trunk/embedded/md/toc.md
>
> nor do I see those in tclhttpd branch list
> https://core.tcl-lang.org/tclhttpd/brlist
>
> neither is the wiki page any help
> https://wiki.tcl-lang.org/page/TclHttpd
>
> what am I missing?
oops the penny finally dropped. We're not talking about tclhttpd at all
but httpd. I'll get me coat.

Re: Tclhttpd not working on ports

<uik5bk$2k9v2$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=12775&group=comp.lang.tcl#12775

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder2.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: rich@example.invalid (Rich)
Newsgroups: comp.lang.tcl
Subject: Re: Tclhttpd not working on ports
Date: Fri, 10 Nov 2023 02:43:00 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 49
Message-ID: <uik5bk$2k9v2$1@dont-email.me>
References: <1407fb03-8b00-4199-be11-4b946b114592n@googlegroups.com>
Injection-Date: Fri, 10 Nov 2023 02:43:00 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="21aa6bc8676047d7de7161fb5ffc1c50";
logging-data="2762722"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+QblLVGuEpIquTCKOy+3St"
User-Agent: tin/2.6.1-20211226 ("Convalmore") (Linux/5.15.117 (x86_64))
Cancel-Lock: sha1:TY7nQ7CcEo9+UsTSbTFHCgpCYz4=
 by: Rich - Fri, 10 Nov 2023 02:43 UTC

Shaun Kulesa <shaunkulesa@gmail.com> wrote:
>I'm trying to run the tclhttpd web server example but every port I
>try on my university wifi or my remote linux virtual machine it will
>say the port is already in use.
>
> couldn't open socket: address already in use
> while executing
> "socket -server [namespace code [list my connect]] -myaddr $ip $port"
> (class "::httpd::server" method "start" line 20)
> invoked from within
> "HTTPD start"
>
> I then try the python http server on the same port afterwards and it
> works.
>
> package require httpd
>
> httpd::server create HTTPD port 8039
>
> HTTPD start

It appears that for httpd 4.3.5 that simply creating the server object
creates the server socket.

This below is from linux. If I do this:

$ netstat -l -v -n -p 2> /dev/null | grep 8039

I have nothing listening on port 8039.

Now if I do:

$ rlwrap tclsh
% package require httpd
4.3.5
%httpd::server create HTTPD port 8039
::HTTPD

And nothing more, and check netstat, I have tclsh listening on 8039:

$ netstat -l -v -n -p 2> /dev/null | grep 8039
tcp 0 0 127.0.0.1:8039 0.0.0.0:* LISTEN 29158/tclsh

Then, attempting to do HTTPD start results in the same 'address in use'
error you are seeing:

% HTTPD start
couldn't open socket: address already in use

Re: Tclhttpd not working on ports

<4e964785-6d01-45bf-ad9c-81dbcf10033bn@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=12776&group=comp.lang.tcl#12776

  copy link   Newsgroups: comp.lang.tcl
X-Received: by 2002:ac8:4607:0:b0:41c:d559:4ea with SMTP id p7-20020ac84607000000b0041cd55904eamr64653qtn.6.1699616954123;
Fri, 10 Nov 2023 03:49:14 -0800 (PST)
X-Received: by 2002:a05:620a:394e:b0:775:76da:672d with SMTP id
qs14-20020a05620a394e00b0077576da672dmr214962qkn.3.1699616953917; Fri, 10 Nov
2023 03:49:13 -0800 (PST)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.tcl
Date: Fri, 10 Nov 2023 03:49:13 -0800 (PST)
In-Reply-To: <uik5bk$2k9v2$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=139.222.233.73; posting-account=Be2r4goAAACg4Ko_BkJ0V-RlkGAdXGng
NNTP-Posting-Host: 139.222.233.73
References: <1407fb03-8b00-4199-be11-4b946b114592n@googlegroups.com> <uik5bk$2k9v2$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <4e964785-6d01-45bf-ad9c-81dbcf10033bn@googlegroups.com>
Subject: Re: Tclhttpd not working on ports
From: shaunkulesa@gmail.com (Shaun Kulesa)
Injection-Date: Fri, 10 Nov 2023 11:49:14 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 1270
 by: Shaun Kulesa - Fri, 10 Nov 2023 11:49 UTC

The examples I have found either don't keep the code running or have errors (including the man page).

Is there a good alternative to httpd?

Re: Tclhttpd not working on ports

<37604700-520b-4c41-850c-0f3e61bbe643n@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=12777&group=comp.lang.tcl#12777

  copy link   Newsgroups: comp.lang.tcl
X-Received: by 2002:a05:620a:1a19:b0:76d:8827:11a5 with SMTP id bk25-20020a05620a1a1900b0076d882711a5mr232462qkb.5.1699625071434;
Fri, 10 Nov 2023 06:04:31 -0800 (PST)
X-Received: by 2002:a17:902:aa08:b0:1cc:ec22:64df with SMTP id
be8-20020a170902aa0800b001ccec2264dfmr1228962plb.2.1699625070908; Fri, 10 Nov
2023 06:04:30 -0800 (PST)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.tcl
Date: Fri, 10 Nov 2023 06:04:30 -0800 (PST)
In-Reply-To: <1407fb03-8b00-4199-be11-4b946b114592n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2001:b011:b808:7679:580:6bbd:cd1d:17d2;
posting-account=7HuFrAoAAACeXIF134GSJY6Z38FI_aXp
NNTP-Posting-Host: 2001:b011:b808:7679:580:6bbd:cd1d:17d2
References: <1407fb03-8b00-4199-be11-4b946b114592n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <37604700-520b-4c41-850c-0f3e61bbe643n@googlegroups.com>
Subject: Re: Tclhttpd not working on ports
From: ray2501@gmail.com (Danilo Chang)
Injection-Date: Fri, 10 Nov 2023 14:04:31 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 3621
 by: Danilo Chang - Fri, 10 Nov 2023 14:04 UTC

Shaun Kulesa 在 2023年11月8日 星期三晚上7:32:31 [UTC+8] 的信中寫道:
> I'm trying to run the tclhttpd web server example but every port I try on my university wifi or my remote linux virtual machine it will say the port is already in use.
>
> couldn't open socket: address already in use
> while executing
> "socket -server [namespace code [list my connect]] -myaddr $ip $port"
> (class "::httpd::server" method "start" line 20)
> invoked from within
> "HTTPD start"
>
> I then try the python http server on the same port afterwards and it works.
>
> package require httpd
>
> httpd::server create HTTPD port 8039
>
> HTTPD start
>
> # Add in a dict based dispatcher
> HTTPD plugin dispatch ::httpd::plugin.dict_dispatch
> # Register the /hello uri to be answered by our new class
> HTTPD uri add * /hello {mixin {content reply.hello}}
>
> oo::class create ::reply.hello {
> method content {} {
> my puts "<HTML><HEAD><TITLE>My Example Server</TITLE></HEAD><BODY>"
> my puts "<h1>Hello World!</h1>"
> my puts "Nice to see you from [my request get REMOTE_HOST]"
> my puts "The time is now [clock format [clock seconds]]"
> my puts </BODY></HTML>
> }
> }

Hello,

I test in httpd 4.3.5.
I think you can try to remove "HTTPD start" this line, because it is not necessary.

And modify
HTTPD uri add * /hello {mixin {content reply.hello}}
To
HTTPD uri add * /hello [list mixin {content ::reply.hello}]

And if you are not in interactive mode, maybe you need to add "vwait forever" in last line.
So the script will be:

package require httpd

httpd::server create HTTPD port 8039

# Add in a dict based dispatcher
HTTPD plugin basic_url ::httpd::plugin.dict_dispatch
# Register the /hello uri to be answered by our new class
HTTPD uri add * /hello [list mixin {content reply.hello}]

clay::define ::reply.hello {
method content {} {
my puts "<HTML><HEAD><TITLE>My Example Server</TITLE></HEAD><BODY>"
my puts "<h1>Hello World!</h1>"
my puts "Nice to see you from [my request get REMOTE_HOST]"
my puts "The time is now [clock format [clock seconds]]"
my puts </BODY></HTML>
}
}

# If not in interactive mode
vwait forever

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor