http knowledge sought

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Elaine Jackson

    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


  • Graham Fawcett

    #2
    Re: http knowledge sought

    "Elaine Jackson" <elainejackson7 355@home.com> wrote in message news:<6r3Cc.861 817$Ig.9977@pd7 tw2no>...[color=blue]
    > 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?[/color]


    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 SimpleHTTPServe r

    handler_class = SimpleHTTPServe r.SimpleHTTPReq uestHandler
    ss = SocketServer.TC PServer( ('', 80), handler_class)
    ss.serve_foreve r()

    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!

    [color=blue]
    > 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.[/color]

    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

    Comment

    • Elaine Jackson

      #3
      Re: http knowledge sought

      "Graham Fawcett" <graham__fawcet t@hotmail.com> wrote in message
      news:e9570f37.0 406222237.39372 ee0@posting.goo gle.com...

      <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


      Comment

      • Scott David Daniels

        #4
        Re: http knowledge sought

        Elaine Jackson wrote:
        [color=blue]
        > 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
        >
        >[/color]
        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 SimpleHTTPServe r
        SimpleHTTPServe r.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.



        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.lawrencegoe tz.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
        Scott.Daniels@A cm.Org

        Comment

        • Simon Dahlbacka

          #5
          Re: http knowledge sought

          Elaine Jackson wrote:[color=blue]
          > "Graham Fawcett" <graham__fawcet t@hotmail.com> wrote in message
          > news:e9570f37.0 406222237.39372 ee0@posting.goo gle.com...
          >
          > <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.[/color]

          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.


          Comment

          Working...