Ok, been away awhile from programming, although I don't know much about programming anyway. My question is about Atomic Web Server. Wanting to learn about web servers.
How was it calculated that this server could serve 255 conections?
Would this code have to be redone to add more connections or is this the limit with PB?
i haven't look at this very well but i think it because of hardware resrictions on it
but also he could of put in a built in limit
or it could be that he ahs some sort of id (othere than ip's) that is a byte number that he used to give to the connections
if thats the case you could reporgramm it ot hold more that that but 155 is quite over my connection
(cable 600k up max)
you need a fiberoptic conncetion to do something like that
Though I don't know for sure where the 255 simultaneous connection limit is imposed I'd say it's internally in PureBasic or a Windows sockets limitation.. It's certainly not a hardware problem or limitation.. Connections don't equal bandwidth so the speed of your Internet connection wouldn't have much to do with the ability to support simultaneous connections..
255 *simultaneous* connections is quite a lot for a web server... That's more than most big web servers support by default AFAIK..
Anyway, someone else can chime in and tell you for sure why it's limited to 255.
Windows allocates a word for sockets. So normal up to 65535 connections per server should be possible. Dont know how other applications can do more. (Edonkey Server eg. allows more then 100.000 connections or even more to one socket.) Dont know how they do it.
To use more than that service providers create clusters of machines that dispacth requests to the port of another cluster.
Image two instances of the same server running on the same machine, when a socket on one get's close to it's limit it the passes requests to the other app, which replies for him....
Imagine google.... how many users do a search at the same time world wide? If the main server could not dispatch the requests to other cluster you would never do a search!
Also this problem in main servers is solved through hardware i believe....
The way file sharing works is diferent, you connect to a port, and the connections for downloads or uploads are made through other ports that are agreed between both machines (see FTP protocol to understand), so in this case you can have up to 65000 ports....
Num3 wrote:255 connections per sockect is a TCP/IP limit...
The way file sharing works is diferent, you connect to a port, and the connections for downloads or uploads are made through other ports that are agreed between both machines (see FTP protocol to understand), so in this case you can have up to 65000 ports....
This is not realy true. Take a look on Edonkey-Servers under windows. Its a single instance and more then 7000 users were connected to my system as I tried it.
Anyway, a (popular) web server can easily exceed 255 connections, afterall images are also counted as a connection.
True, but there is a big difference in 255 connections and 255 simultaneous connections. That's 255 different connections at *exactly* the same time. I was just making the point that 255 isn't a low number for a web server (since HTTP is stateless)...
J. Baker wrote:
How was it calculated that this server could serve 255 conections?
Would this code have to be redone to add more connections or is this the limit with PB?
I just looked at the code (dated 25/3/2001) and the whole thing is single threaded..it can only handle 1 connection at a time, so where did the 255 connections come from( maybe CreateNetworkServer() only handles 255 connections with older versions of Windows)?
If you want more concurrent connections, then you gotta spin off each request to a separate thread, but then you get into problems because of PB`s strings being unsafe to use in threads (
I use the Atomic Web Server at work (http://cgallery.dyndns.org) and looking at the code it doesn't look threaded. So I wondered how it could handle more than a single connection. I think it is because the library functions it uses to transmit files are themselves threaded or threads? That is, I can have two client machines at work simultaneously download large files from the Atomic Web Server and AWS will still serve up pages to any and all other clients coming in. So I assume the small part of the code that parses requests can only handle a single client at a time, but that code runs so fast and hands things off to the threaded library functions so quickly that it doesn't matter?
If I have it xfer a 200-MB file, which doesn't happen instantly, it can xfer it to more than a single client at a time. I've tried it with at least two different clients.
If you go to http://cgallery.dyndns.org and download the zipped manual to your machine several times simultaneously (just keep clicking on it), you'll see two things: (1) The Atomic Web Server can do more than one thing at a time and (2) I need more bandwidth.