On Mon, 2010-12-13 at 14:42 -0500, Martin wrote:
On 13/12/10 10:19 AM, Roman Haefeli wrote:
On Fri, 2010-12-10 at 10:54 -0500, Hans-Christoph Steiner wrote:
On Dec 10, 2010, at 5:12 AM, IOhannes m zmölnig wrote:
On 12/09/2010 10:28 PM, Roman Haefeli wrote:
@ IOhannes Though I like this 'stable'/reliable behaviour of iemnet's [tcpserver], I wonder what happens, if it keeps sending data to the unreachable client. Will it just go on and buffer everything until the whole RAM of the computer is consumed? If so, wouldn't it be more wise to just disconnect that client at some point in order to avoid the box running out of memory?
you can query the fillstate of the buffer from within the patch and act upon that: if you prefer to disconnect after 300MB (because of the 2.5GB memory you have, 2GB are only swap), or if you rather go and crash or whatever...it's up to you.
Great! That's even better than to disconnect clients at some arbitrary buffer size.
What? It's better to crash the server than to disconnect an unresponsive client?
Why crashing the server? I don't get the alarmism. If a patch needs to allocate 300 MB of RAM for storing sound files for fast access, that's a sensible reason to do so. Not less sensible is it to allocate 300 MB for buffering data to be transmitted over a network when necessary. Ok, 300 MB seems a lot (nowadays, at least), but that's some made up value. No need to stick with that. It's the responsibility of the patch programmer to ensure, that the required amount of memory is available, anyway. Not less so when doing GridFlow and storing huge grids, for instance.
If a networking patch programmer thinks it's stupid to buffer any data, they can decide to throw messages away instead of buffering them. [iemnet/tcpserver] gives that freedom. So what is your point?
And if the server itself loses its connection it will buffer 300MB for each client and then crash?
It will crash, if it runs out of memory (as any other Pd patch will as well). To stick with the somewhat arbitrary 300 MB example: What I was excited about is the ability to let the patch disconnect clients based on some values like (as one of many examples) buffer size. The example application would read: "If the buffer of a certain socket exceeds 300 MB, the according client will be disconnected by the server". Again, nobody said that one must use 300 MB as a threshold.
Roman