You might not have to use alarm. I think you can make the connection non-blocking, then detect when the connection is completed using select. select accepts a timeout, which would replace your use of alarm.
If that works, the advatage is you can extend that model to initiate connections to more than one address at a time, and work with the connections as they become available. This is particularly useful if you expect a lot of timeouts.
In reply to Re: Signal handlers and scoped variables, or Nested subs?
by ikegami
in thread Signal handlers and scoped variables, or Nested subs?
by kwaping
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |