473,385 Members | 1,356 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,385 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 1618
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.