HTTP Protocol question

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

    HTTP Protocol question

    I'm trying to learn how the HTTP protocol works. When aserver has many
    clients accessing it at the same time. Say 200 people. How does it maintain
    connection with 200 different concurrent client using only port 80? From
    what I've read and if I understand this correctly, a TCP/UDP port a maintain
    connection with one client at a time. Can someone explain it to me? I
    believe FTP works the same way right?


    Thanks in advance
    Aaron


  • Scott Allen

    #2
    Re: HTTP Protocol question

    Hi Aaron,

    Here are some of the basics:

    You can only open a single *passive* connection on a port. A passive
    connection is a 'connection' that waits and listens for incoming
    active connections. Once the web server starts listening on port 80 -
    then no one else will be allowed to listen for incoming connections on
    port 80 - this is why each server program listens on a different port.

    You can have multiple *active* connections on a single port, as long
    as each connection is unique, as determined by these 4 pieces of
    information:

    1) Host IP address
    2) Host port
    3) Client IP address
    4) Client port

    So for instance, if I run "netstat" from the command line I see my
    computer has 2 concurrent connections open to a web server on my
    network, but these connections originate from different local ports
    (that IE picked at random):

    Proto Local Address Foreign Address
    TCP mycomputer:4239 10.10.10.10:htt p
    TCP mycomputer:3927 10.10.10.10:htt p


    (Also note Netstat replaces IP and PORT numbers with names when it
    can).


    As long as each connection is unique, there is never any confusion as
    to where to send a packet. You can imagine 200 concurrent users
    working because those 200 will all have different ClientIP:Port
    address portions - and because each connection is *uniquely
    identifiable* - the web server will always know where to send the
    response.

    Make sense?

    --
    Scott



    On Mon, 23 May 2005 21:58:46 -0700, "Aaron" <kuya789@yahoo. com> wrote:
    [color=blue]
    >I'm trying to learn how the HTTP protocol works. When aserver has many
    >clients accessing it at the same time. Say 200 people. How does it maintain
    >connection with 200 different concurrent client using only port 80? From
    >what I've read and if I understand this correctly, a TCP/UDP port a maintain
    >connection with one client at a time. Can someone explain it to me? I
    >believe FTP works the same way right?
    >
    >
    >Thanks in advance
    >Aaron
    >[/color]

    Comment

    • Scott Allen

      #3
      Re: HTTP Protocol question

      Hi Aaron,

      Here are some of the basics:

      You can only open a single *passive* connection on a port. A passive
      connection is a 'connection' that waits and listens for incoming
      active connections. Once the web server starts listening on port 80 -
      then no one else will be allowed to listen for incoming connections on
      port 80 - this is why each server program listens on a different port.

      You can have multiple *active* connections on a single port, as long
      as each connection is unique, as determined by these 4 pieces of
      information:

      1) Host IP address
      2) Host port
      3) Client IP address
      4) Client port

      So for instance, if I run "netstat" from the command line I see my
      computer has 2 concurrent connections open to a web server on my
      network, but these connections originate from different local ports
      (that IE picked at random):

      Proto Local Address Foreign Address
      TCP mycomputer:4239 10.10.10.10:htt p
      TCP mycomputer:3927 10.10.10.10:htt p


      (Also note Netstat replaces IP and PORT numbers with names when it
      can).


      As long as each connection is unique, there is never any confusion as
      to where to send a packet. You can imagine 200 concurrent users
      working because those 200 will all have different ClientIP:Port
      address portions - and because each connection is *uniquely
      identifiable* - the web server will always know where to send the
      response.

      Make sense?

      --
      Scott



      On Mon, 23 May 2005 21:58:46 -0700, "Aaron" <kuya789@yahoo. com> wrote:
      [color=blue]
      >I'm trying to learn how the HTTP protocol works. When aserver has many
      >clients accessing it at the same time. Say 200 people. How does it maintain
      >connection with 200 different concurrent client using only port 80? From
      >what I've read and if I understand this correctly, a TCP/UDP port a maintain
      >connection with one client at a time. Can someone explain it to me? I
      >believe FTP works the same way right?
      >
      >
      >Thanks in advance
      >Aaron
      >[/color]

      Comment

      • Andrew D. Newbould

        #4
        Re: HTTP Protocol question

        In message <uPNYC1BYFHA.11 48@tk2msftngp13 .phx.gbl>, Aaron
        <kuya789@yahoo. com> writes[color=blue]
        >I'm trying to learn how the HTTP protocol works. When aserver has many
        >clients accessing it at the same time. Say 200 people. How does it maintain
        >connection with 200 different concurrent client using only port 80? From
        >what I've read and if I understand this correctly, a TCP/UDP port a maintain
        >connection with one client at a time. Can someone explain it to me? I
        >believe FTP works the same way right?
        >
        >
        >Thanks in advance
        >Aaron
        >
        >[/color]

        In addition to Scot's excellent explanation ...

        A web server normal deals with many clients by maintaining a Thread
        Pool. The server determines whether it should Accept the incoming
        connection and then passes the request, along with the client socket
        details, to the thread pool. The thread pool then deals with the request
        while the main Thread goes back to waiting for the next request.

        This approach enables the web server to handle potentially thousands of
        requests (seamingly simultaneously) .

        --
        Andrew D. Newbould E-Mail: newsgroups@NOSP AMzadsoft.com

        ZAD Software Systems Web : www.zadsoft.com

        Comment

        • Andrew D. Newbould

          #5
          Re: HTTP Protocol question

          In message <uPNYC1BYFHA.11 48@tk2msftngp13 .phx.gbl>, Aaron
          <kuya789@yahoo. com> writes[color=blue]
          >I'm trying to learn how the HTTP protocol works. When aserver has many
          >clients accessing it at the same time. Say 200 people. How does it maintain
          >connection with 200 different concurrent client using only port 80? From
          >what I've read and if I understand this correctly, a TCP/UDP port a maintain
          >connection with one client at a time. Can someone explain it to me? I
          >believe FTP works the same way right?
          >
          >
          >Thanks in advance
          >Aaron
          >
          >[/color]

          In addition to Scot's excellent explanation ...

          A web server normal deals with many clients by maintaining a Thread
          Pool. The server determines whether it should Accept the incoming
          connection and then passes the request, along with the client socket
          details, to the thread pool. The thread pool then deals with the request
          while the main Thread goes back to waiting for the next request.

          This approach enables the web server to handle potentially thousands of
          requests (seamingly simultaneously) .

          --
          Andrew D. Newbould E-Mail: newsgroups@NOSP AMzadsoft.com

          ZAD Software Systems Web : www.zadsoft.com

          Comment

          • Aaron

            #6
            Re: HTTP Protocol question

            This makes perfect sense. Thank you guys so much.

            Comment

            Working...