Simon,
You didn't mention the operating system under which your code is running. If it's Solaris, you can tweak the time_wait interval with ndd (add it to an /etc/init.d script if you'd like) like this:
ndd set /dev/tcp tcp_time_wait_interval 30000
Where 30000 is the interval in milliseconds. Everything I've read seems to show this as the bare minimum you can get away with without generating problems. If you need a few more filehandles, you can set that with plimit:
plimit -n 4096,1024 $PID
where $PID is the process id of your parent. Or, you can add this to /etc/system (and reboot) to affect all processes:
rlim_fd_max=4096
rlim_fd_cur=1024
Check out the Tunable
TCP/IP Parameters
section or the
General I/O section of the Tunable Parameters Reference
Manual for more info. While neither of these will close your socket, it'll give you a bit more overhead so that your sockets will time out on their own without causing you grief. Best of luck.
-beernuts
Edit (4/1) - removed redundant 'Reference Manual' text
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.