[plt-scheme] Solved (Was: How many sockets can be open?)

From: Erich Rast (erich at snafu.de)
Date: Mon Jul 23 06:48:55 EDT 2007

Thanks for the help, I've figured it out. Just in case someone's  
interested, here is what to do.

To change the limit in OS X for DrScheme itself (for testing with  
GUI), start it directly in in terminal:

% ulimit -n 10000
% /Applications/PLT\ Scheme\ v370.6/DrScheme.app/Contents/MacOS/DrScheme

This doesn't work with OS X's open command, you need to directly  
start the DrScheme executable in the .app bundle as in the above  
example. To guard against DoS attacks, I'll test for the ulimit on OS  
X and conservatively estimate the server's connection limits  
accordingly (something like ulimit/2-other open files-safety factor):

(require (lib "process.ss"))

(define (ulimit)
   (let ((li (process "ulimit -n")))
     (let ((v (read (car li))))
       (close-input-port (car li))
       (close-input-port (cadddr li))
       (close-output-port (cadr li))
       v)))

It would be nice to get this cross-platform, so if others know how to  
obtain this value on other platforms, please let me know.

Best regards,

Erich


Posted on the users mailing list.