470,613 Members | 2,448 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,613 developers. It's quick & easy.

http knowledge sought

I want to run an http server but I don't know how to get started. I've read
through the documentation for the relevant modules, but I don't have enough http
knowledge to get the initial spark I need, and I can't seem to track down the
knowledge in question on the web or at the library. Maybe somebody can point me
toward some resources?

In case you feel like answering a specific question, here's one: How does http
addressing work? I remember reading in a book about dot-separated quadruples of
numerals, written in decimal but required to be two hexadecimal digits long.
Problem is, I can't get hold of that book right now.

Any help will be much appreciated.

Peace
Jul 18 '05 #1
4 1532
"Elaine Jackson" <el***************@home.com> wrote in message news:<6r3Cc.861817$Ig.9977@pd7tw2no>...
I want to run an http server but I don't know how to get started. I've read
through the documentation for the relevant modules, but I don't have enough http
knowledge to get the initial spark I need, and I can't seem to track down the
knowledge in question on the web or at the library. Maybe somebody can point me
toward some resources?

What is it you're trying to accomplish, Elaine? There are a number of
ways to write a Web server in Python, but how you intend to use that
server will determine which ways are most appropriate.

Probably the easiest HTTP server to write in Python is:

import SocketServer
import SimpleHTTPServer

handler_class = SimpleHTTPServer.SimpleHTTPRequestHandler
ss = SocketServer.TCPServer( ('', 80), handler_class)
ss.serve_forever()

which will run a Web server, serving up files from the current
directory (the one from which you ran the program above). Run the
program, and visit http://localhost/ to see your server in action.

But chances are that's not what you need. You'll find the folks on
this list are tremendously helpful, but aren't much use unless you're
clear about what your end-goals are. Please elaborate!

In case you feel like answering a specific question, here's one: How does http
addressing work? I remember reading in a book about dot-separated quadruples of
numerals, written in decimal but required to be two hexadecimal digits long.
Problem is, I can't get hold of that book right now.


Erm, it sounds like you're thinking about Internet Protocol (IP)
addressing, which is more fundamental than HTTP. TCP and IP are the
foundational protocols upon which HTTP is built; but so are FTP,
telnet, SMTP (e-mail), etc.

Google for "internet protocol tutorial" to learn more about IP
addresses.

-- Graham
Jul 18 '05 #2
"Graham Fawcett" <gr*************@hotmail.com> wrote in message
news:e9**************************@posting.google.c om...

<snip>
| Please elaborate!

OK. It would be nice to know a way in which somebody on another machine could
access the pages your example serves. Not necessarily a cute or convenient way,
but just a way. That would give me the foot-in-the-door feeling I'm looking for.

<snip>
| Google for "internet protocol tutorial" to learn more about IP
| addresses.

This worked well. Thanks
Jul 18 '05 #3
Elaine Jackson wrote:
I want to run an http server but I don't know how to get started. I've read
through the documentation for the relevant modules, but I don't have enough http
knowledge to get the initial spark I need, and I can't seem to track down the
knowledge in question on the web or at the library. Maybe somebody can point me
toward some resources?

In case you feel like answering a specific question, here's one: How does http
addressing work? I remember reading in a book about dot-separated quadruples of
numerals, written in decimal but required to be two hexadecimal digits long.
Problem is, I can't get hold of that book right now.

Any help will be much appreciated.

Peace

Probably the simplest thing to do is something like:

Create a file 'myserver.py' in a directory with some .html
(or .htm) files you want to see. Let's pretend one of the
html files is named 'slithey.html'. Here is the body (no
indentation in file) of 'myserver.py':

import SimpleHTTPServer
SimpleHTTPServer.test()

Open a command line in your OS, go to the directory you chose above,
and on that command line type the python magic incantation to run
a python program.

As the program starts, it will mention a port. For the purposes of
this recipe, I'll pretend the port number printed out is "8123".
While your program is still running, open a browser.
Into the browser, enter one of the following URLs.

http://127.0.0.1:8123/slithey.html
http://localhost:8123/slithey.html
Or, if you know the name of your computer, you can substitute that
for "localhost". Similarly, if you know the TCP/IP address of your
computer, substitute it for 127.0.0.1

localhost and 127.0.0.1 are "magic" ways to refer to your own computer.
Neither should be using your actual internet connection (but you
might get a cute page in firefox if you get the port number wrong).

If you don't know your IP number, you can browse to:
<http://www.lawrencegoetz.com/programs/ipinfo/>

which creates a page with your number (every connection needs to
know the number of the other side in order to reply).

<http://www.wown.com/j_helmig/tcpip.htm>
explains some basic tcp/ip address stuff (but operational stuff there
is for Microsoft Windows).

--
-Scott David Daniels
Sc***********@Acm.Org
Jul 18 '05 #4
Elaine Jackson wrote:
"Graham Fawcett" <gr*************@hotmail.com> wrote in message
news:e9**************************@posting.google.c om...

<snip>
| Please elaborate!

OK. It would be nice to know a way in which somebody on another machine could
access the pages your example serves. Not necessarily a cute or convenient way,
but just a way. That would give me the foot-in-the-door feeling I'm looking for.


unless there is firewalls in between you'll just need to browse to

http://your.ip.address.goes.here/ (the IP has to be a public one..)

i.e.

http://123.123.123.123/
Jul 18 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Maurice LING | last post: by
4 posts views Thread by Dean R. Henderson | last post: by
3 posts views Thread by mailto.anand.hariharan | last post: by
3 posts views Thread by NAU programmers | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.