Webserver serving multiple connections simultanous

In this category you can exchange your programming questions and solutions.
Post Reply
AmkSoft
Posts: 4
Joined: Sat Jun 02, 2012 5:47 pm

Webserver serving multiple connections simultanous

Post: # 1249Post AmkSoft
Sat May 28, 2016 4:45 pm

Hi,

Is it possible in FnxBasic to create a Webserver serving multiple connections simultanously (using the "ServerSocket")?

As far i can see it can handle multiple connections at the same time (there is an index on a socketconnection). This works fine as the client does the connect+disconnect (like if you use ServerSocket to create a chatbox).
But a browser does not disconnect, so the server has to close the connection with the browser as soon it has send al the data (webpage/image eg.) to the browser (or else the browser thinks there is coming more data and shows it is waiting on the disconnect).

There is an Active (True or False) or Open/Close, but his does not use an index to adress a particular socket connection to close, as far as i can see it closes all the socket connections.

I can create this in VB6 Using the WinSocket as the WinSocket itself is indexed, so if there are 5 browsers simultanous connecting there are 6 winsockets (5 comminucating with the browsers and the sixed(6) is the listener to accept a new connection. If the server has send all the to 1 of the browsers it disconnects(closes) the specific socket, so the browser knows it has all the data. The other sockets are not affected by this disconnect/close.

But i cannot get this to work using ServerSocket in FnxBasic, or i`m doing something completely wrong.

Can someone give me a hint?

Thanks
Martie.

annefmoreno
Posts: 3
Joined: Fri Nov 18, 2016 7:20 am

Webserver serving multiple connections simultanous

Post: # 1250Post annefmoreno
Fri Nov 18, 2016 8:51 am

Making multiple HTTP requests concurrently hurts the performance. To understand why, we should first understand briefly about how web servers are architected. Firstly, servers (whether it’s a physical box in your office or a VPS or cloud instance) can handle only a given number of requests per second (depending on the hardware). In fact, most servers vie to handle 10,000 concurrent connections.  Refer http://essaysorigin.com/ to get reviews of various online writers.

AmkSoft
Posts: 4
Joined: Sat Jun 02, 2012 5:47 pm

Webserver serving multiple connections simultanous

Post: # 1251Post AmkSoft
Sun Apr 30, 2017 8:13 am

[quote author=303F3F34373C3E2334510 link=1464453903/1#1 date=1479459070]Making multiple HTTP requests concurrently hurts the performance. To understand why, we should first understand briefly about how web servers are architected. Firstly, servers (whether it’s a physical box in your office or a VPS or cloud instance) can handle only a given number of requests per second (depending on the hardware). In fact, most servers vie to handle 10,000 concurrent connections.  Refer http://essaysorigin.com/ to get reviews of various online writers. [/quote]

Your answer is not the one i was hoping for  :D
I meant: The current ServerSocket as it is implemented in FNXBasic is not designed to use for WebServices, it is designed for use as like IRC services (look at the demo included with the FNXBasic ServerSocket). The ServerSocket is missing ( i cannot find them) parameter-settings/commands so it ca be used as a webserver. The VB6 ServerSocket includes thes settings. If you use VB6 te create a webserver it can handle multiple browsers requesting pages "at the same time". But the FNXBasic ServerSocket cannot. Of course if there is only 1 Browser at a time connecting it can be done, thats easy. Only 1 ServerSocket is needed. If the WebServer ended sending the requested pade is closes the Socket and sets it to listening for the next page request (This means that alle the browsers have to agree who is first and who is next and have to wait on each other to get a webpage).
But as soon you use two browsers to get a page from the webserver build with the ServerSocket the sencond ons get a "closed/hanging connection" because the ServerSocket closes all the connections when the first request is finished)

You shoult try it by yourself: Create a webserver using the FNXBasic ServerSocket and the VB6 ServerSocket. The you see what i meant.
(Please forget about Performance, Architecture and what so ever, thats not an issue. The FNXBasic ServerSocket can not even handle two Page request.

Post Reply