home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.unix.questions
- Path: sparky!uunet!spool.mu.edu!uwm.edu!caen!malgudi.oar.net!news.ans.net!cmcl2!panix!rayc
- From: rayc@panix.com (Ray Compton)
- Subject: Re: socket timeouts
- Message-ID: <1992Dec16.005123.4041@panix.com>
- Date: Wed, 16 Dec 1992 00:51:23 GMT
- References: <1gbaqcINN3se@bigboote.WPI.EDU>
- Organization: League of American Wheelmen - the LAW
- Lines: 27
-
- In <1gbaqcINN3se@bigboote.WPI.EDU> yeasah@bigwpi.WPI.EDU (Yeasah G. Pell) writes:
-
- >Hey wizzards!
- > Q: How can one change the amount of time a connect() function
- > takes to time out when attempting to connect to an unconnected
- > address on the internet? Currently it waits forever. I
- > see the select() function has a value for timeout, but I
- > don't know if this is related to connect or not.
-
- Yeasah,
-
- I've usually done this with an alarm in the following way:
-
- alarm(MAX_TIMEOUT_IN_SECS);
- ret = connect(...);
- if ((ret < 0) && (errno == EINTR)) {
- /* Timed out waiting for connect */
- }
-
- It's a bit of a kludge but it will do the trick.
-
- /rayc
- --
- *---------------------------------------------------------------------*
- * magic o--> more magic | Ray Compton | "A waste, is a *
- * | <rayc@panix.com> | terrible thing *
- * Don't touch that dial !! | <rayc@command.com>| to mind" - NRC *
-