473,396 Members | 2,113 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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
Nov 22 '05 #1
5 1619
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:http
TCP mycomputer:3927 10.10.10.10:http
(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
http://www.OdeToCode.com/blogs/scott/
On Mon, 23 May 2005 21:58:46 -0700, "Aaron" <ku*****@yahoo.com> wrote:
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


Nov 22 '05 #2
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:http
TCP mycomputer:3927 10.10.10.10:http
(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
http://www.OdeToCode.com/blogs/scott/
On Mon, 23 May 2005 21:58:46 -0700, "Aaron" <ku*****@yahoo.com> wrote:
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


Nov 22 '05 #3
In message <uP**************@tk2msftngp13.phx.gbl>, Aaron
<ku*****@yahoo.com> writes
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


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: ne********@NOSPAMzadsoft.com

ZAD Software Systems Web : www.zadsoft.com
Nov 22 '05 #4
In message <uP**************@tk2msftngp13.phx.gbl>, Aaron
<ku*****@yahoo.com> writes
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


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: ne********@NOSPAMzadsoft.com

ZAD Software Systems Web : www.zadsoft.com
Nov 22 '05 #5
This makes perfect sense. Thank you guys so much.

Nov 22 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Elaine Jackson | last post by:
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...
8
by: turnit \(removethis\) | last post by:
I have a login form that uses the post method to carry the information to the next page. The form works just fine in ie6.0, but fails in mozilla and fails in ie5.2 on a mac. "HTTP/1.1 400 Bad...
14
by: DaveC | last post by:
I know this is the wrong group but I need a little pointing in a direction please. I need to write an implementation of a yet to be published protocol. It is transported over the internet via...
16
by: Andy Lai | last post by:
Hi, I am writing a C++ program which needs to post an XML to an HTTP server periodically and the program will run on different platforms including w32, linux, and unix. I see that there are...
0
by: Dde | last post by:
Hi, Sorry for re-posting on a similar subject. The problem I have is that my webmethods using complex objects as parameters are not exposed in the WSDL under the HTTP Post protocol section but...
4
by: Bob Badger | last post by:
Hi, Simple question (although I guess with a complicated answer). Is HTTP an async protocol? For instance, if I send a message to a c# webservice via http what is the protocol actually doing? ...
1
by: Benry | last post by:
Hi guys. I hope I can discuss Twisted here. If not, direct me to the correct place please. My question(s): I'm working on a custom network protocol (application layer in TCP/IP model) for a...
10
by: rup | last post by:
Hello, This is my first application on socket programming in vc++. I am facing problem that how to make connection to server, & make GET/POST request by HTTP. Please help me. Its urgent.......
5
by: =?Utf-8?B?Q2hhcmxlc0E=?= | last post by:
hi folks does anyone know of any articles on the web that explain clearly what is happening (in detail) when you post an .aspx page to the web server and when it returns a new page to your...
2
by: rn5a | last post by:
Using CDO.MESSAGE, can e-mails in ASP be sent using the HTTP protocol instead of the SMTP protocol? If yes, then how? If no, then is there any other way to send e-mails in ASP using the HTTP...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.