I am a newbie to much of this so please bear with me. After much reading and googling my understanding is this:
A user at a pc using a browser is a client. the web page requested creates a connection at the server. the web page has text, images, sound etc each of which makes a request of the connection. Now in order to handle concurrent connections I understand a new thread for each connection can be used. Is there a mechanism [like multiple threads] that exists to handle each request for the different parts of the web page? Indeed is it even necessary?
In the good ol' days of Netscape, you could actually configure the number of concurrent connections. At that time, IE was pathetic, I believe allowing for only 2 concurrent connections, while Netscape allowed (by default) for up to 6, and therefore significantly outperformed IE. Mind you, I'm talking 13 years ago or so.
The interesting thing was, the number of concurrent connections was also in the [some committee's] standards, and Netscape actually exceeded that. Web servers could theoretically block too many connections, and in fact, in my analysis of some websites, did so. Which is a good thing, when you think about it.
Now, as to your question, each connection for a resource on the web page is handled by a separate thread on the web server, up to the limit of the thread pool on the web server. Now, the database connections (at least if they're written in .NET) have a connection pool as well, which may be different from the web server's thread pool, so you have to consider both the web server's thread pool mechanism as well as potentially the thread pool of the database, if resources are stored in a database rather than the file system.
And finally, the mechanism that handles each request as a separate thread is not necessarily implemented in the web server's application code--by the time the web server application gets the request, it's already running in a separate thread by virtue of the underlying TCP/IP "open" process (that is to say, the OS and/or the service that runs web server applications), so the web server application doesn't need to do anything more than handle the request.
And yes, it's absolutely necessary because (I believe) the service that handles the TCP/IP connection request is agnostic to who is making the request, so threading is necessary to ensure the performance of all connection requests, regardless of the source. Obviously, the aforementioned "don't allow more than [x] connections per client" does pay attention to who is making the connection request. But other than blocking too many connections, I believe everything funnels through the same process.
Hopefully people who know more about this than me will correct any errors I've made in this discussion!
many thanks Marc. So if i were to write my own server would it be enough to have the main process just looping forever accepting any connection request and pass the socket descriptor to a new thread it would create to handle the connection request. ie a client requests a web page, a new thread is created and each further request for items making up the web page would be treated as another connection request such that a further thread would be created.?
Assuming this particular web page was made up of 3 things:
a .txt file
a .jpg image
a .mp3 sound bite.
Oh yes, and i'm on winxp.
Are you writing your own web server, or an application living in a web server like IIS?
If you're writing your own web server (that is, implementing your own TCP/IP connection protocols) then usually you create a thread that then calls the "wait for connection" .NET framework API (or whatever framework you're using) which is blocking. You supply a callback method, which the API function will call asynchronously (so it lives in its own thread), and there you handle the request and exit the thread when done.
If you're writing an application using something like IIS, then you don't have to worry about all this - you just let the web application framework handle all this. You would then "simply" associate a route (a URL) to a specific function that handles the URL.
There's lots of examples here on CP, I would suggest poking around and getting familiar with both how to write a web server and also how to handle resource requests in a web application.
thank you Marc. I was going to have a go at writing my own [simplified] web server [akin to Apache]. I have done a few progs that use multiple threads so for my learning this is my next step.
I will search here for some examples.
I [think I] get the idea of a new thread for each
"select ( 0, &ReadFDs, .../ accept ( sockfd,"
[i.e. connection?] coming in - one for each client [ie separate browser] but my trouble comes with the handling of the different parts of what makes up the web page. For instance if an SQL call was required would this thread do it or would its function end when it sent the .html file and then would the clients browser go through the .html file and make requests of the server for each URL contained within the .html the servers new thread sent it.? Perhaps I'm not explaining my problem clearly.
Anyway Marc thank you for taking the time to help. It really is appreciated. Now for some searching...
I have developed a web application with a lot of data viewing and sorting functions, but I need to give the users the ability to request reports. The reports are quite large so they can nae sit and let them run synchronously, so I was thinking about a reporting engine allowing queueing of reports, monitoring report status (Limited status that is), and a notification when the report is done via SMTP probably, though I might choose to alert them another way, I am unsure right now.
I have not worked extensively with web services, so I am drawing a bit of a blank on where to get started. I have built my service application and added the EF data model. I was thinking the next step would be to build the engine that accepts or retrieves the data and runs the reports, I am just not sure how to publish that functionality so that it can be consumed by the website.
I don't need anyone to write for me, just point me in the right direction. I spent time on Google, but most of what I came up with was reference to Telerik reporting or creating a WCF data service for SSRS.
Uncheck means, deselected by its own.
Suppose if any user checks a radio button, the whole list item will be highlighted showing its selected.
But here, the list item is not highlighted ,only the radio button is checked.And that state is not stable.
I dont have any refresh interval implemented.
And the id is rdList. Its a typo. ,my mistake
Couple of other information:
I am creating a Sharepoint list,where checkboxes are allowed. The requirement is ,the user should be able to select only one listitem at a time.Thats why I am changing the checkboxes to radio button. Again, the first list item should be selected by default.Hope, this information is sufficient.