Socket : how to deal with traffic jam ?
Posted: Sun Dec 12, 2010 11:25 am
I have a socket server, and several clients on the local network.
The clients connect, send a query (SQL), the server receives the query, processes the query, and sends back the result. Clients cut the connexion. And start again. etc.
It's working fine.
Classic architecture :
server side :
accept connections on 8192 with message "Connection"
read from socket theIP until return with message "contacted"
client side :
open socket to lip with message connected
write "someData"&return to socket theSocket
read from socket theSocket until "#" with message "incoming"
close socket theIP
But I fail to understand what could happen if the server receives too many connexions ?
While working to process a SQL query (let's say, the socket server wait severals seconds for the SQL server to send the result), another liveCode client sends another query ? How LiveCode can deal with this situation ?
There is like a buffer ? First in, first out ? Or data could be lost ?
Or it would be better to use a RunRev CGI server ? Each client sends a query, which opens for each one thread, right ? problem solved ?
The clients connect, send a query (SQL), the server receives the query, processes the query, and sends back the result. Clients cut the connexion. And start again. etc.
It's working fine.
Classic architecture :
server side :
accept connections on 8192 with message "Connection"
read from socket theIP until return with message "contacted"
client side :
open socket to lip with message connected
write "someData"&return to socket theSocket
read from socket theSocket until "#" with message "incoming"
close socket theIP
But I fail to understand what could happen if the server receives too many connexions ?
While working to process a SQL query (let's say, the socket server wait severals seconds for the SQL server to send the result), another liveCode client sends another query ? How LiveCode can deal with this situation ?
There is like a buffer ? First in, first out ? Or data could be lost ?
Or it would be better to use a RunRev CGI server ? Each client sends a query, which opens for each one thread, right ? problem solved ?