I tried it.  On the client side:

jeffs@jeffs-desktop:~/python (hints_dev)* $ curl localhost:1234
hello!jeffs@jeffs-desktop:~/python (hints_dev)* $ curl 192.168.0.16:1234
hello!jeffs@jeffs-desktop:~/python (hints_dev)* $ curl -6 http://
[2602:61:7e5c:3b00:e52d:317e:9f1:2300]:1234
curl: (7) Failed to connect to 2602:61:7e5c:3b00:e52d:317e:9f1:2300 port
1234: Connection refused
jeffs@jeffs-desktop:~/python (hints_dev)* $
So it works under IPv4 and does not work under IPv6.  What does it look
like on the server side?

jeffs@jeffs-desktop:~/python (hints_dev)* $ python webpy_demo.py 1234
http://0.0.0.0:1234/
127.0.0.1:38548 - - [03/Nov/2017 17:03:25] "HTTP/1.1 GET /" - 200 OK
127.0.0.1:38590 - - [03/Nov/2017 17:06:41] "HTTP/1.1 GET /" - 200 OK
192.168.0.16:39062 - - [03/Nov/2017 17:06:52] "HTTP/1.1 GET /" - 200 OK
127.0.0.1:38624 - - [03/Nov/2017 17:07:58] "HTTP/1.1 GET /" - 200 OK
192.168.0.16:39094 - - [03/Nov/2017 17:08:04] "HTTP/1.1 GET /" - 200 OK

I suspect the problem is that you are using public_ip as the IPv4 address.
Try using 127.0.0.1.  That should work.

That it doesn't work under IPv6 is not unexpected and could probably be
fixed easily.


Best,

Jeff



On Thu, Nov 2, 2017 at 11:25 PM, Yinuo Hong <[email protected]> wrote:

> I copied the sample program from http://webpy.org:
> =====main.py=====
> *import web*
> *urls=('/','Handle',)*
> *class Handle:*
> *    def GET(self):*
> *        return 'hello!'*
> *if __name__=="__main__":*
> *    app=web.application(urls, globals())*
> *    app.run()*
> ================
> Then type:# *python main.py 1234*
> It returns: *http://0.0.0.0:1234/ <http://0.0.0.0:1234/>*
> And netstat returns: * tcp        0      0 0.0.0.0:1234
> <http://0.0.0.0:1234>            0.0.0.0:*               LISTEN
> 10143/python*
>
> However, "http://public_ip:1234"; is not reachable, and returns
> *ERR_CONNECTION_TIMED_OUT*
>
> The Firewall service have been turned off.
> Change to other ports doesn't help.
> I don't know how can I work on it for the next step... anyone can help?
>
> --
> You received this message because you are subscribed to the Google Groups
> "web.py" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/webpy.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Jeff Silverman, linux sysadmin
nine two four   twentieth avenue east
Seattle, WA, nine eight one one two -3507
(253) 459-2318
[email protected] (note the zero!)
http://www.commercialventvac.com
See my portfolio of writings and talks
<http://www.commercialventvac.com/portfolio.html>

-- 
You received this message because you are subscribed to the Google Groups 
"web.py" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/webpy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to