Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re^2: Timeouts: Any alternative to alarm in Win32?

by salva (Canon)
on Dec 03, 2008 at 14:18 UTC ( [id://727682]=note: print w/replies, xml ) Need Help??


in reply to Re: Timeouts: Any alternative to alarm in Win32?
in thread Timeouts: Any alternative to alarm in Win32?

Establishing the TCP connection and resolving the host name are still done synchronously in your code and the maximum 5s timeout set in the OP may be surpassed.

That's why I was suggesting POE... though, if I recall correctly, there was some limitation on Windows regarding asynchronous TCP connection establishing, so maybe even POE will not be enough.

Replies are listed 'Best First'.
Re^3: Timeouts: Any alternative to alarm in Win32?
by BrowserUk (Patriarch) on Dec 03, 2008 at 16:30 UTC
    Establishing the TCP connection and resolving the host name are still done synchronously in your code

    True. Again, if you use the native Apis for DnsQueries() and establishing TCP connections then this is easily resolved, but no access is provided when working through Perl's POSIX-compatibility emulations.

    As I understand it, the alarm method doesn't work properly on *nix unless you disable safe-signals--and that's inherently dangerous to perl's internals.

    That's why I was suggesting POE...

    Kind of like recommending the use of an 18-wheeler to fetch the milk. Feasible but....

    If POE had solutions to timing out the TCP SYN-WAIT and DNS Query problems on Win32, then it would be far better to extract them and make them available for use by non-event driven code, than to require a BSc (O.Eng.) to gain access to them.

    Of course, it would require a Master's Degree in OverEngineering, and the patience of a saint, to wade through the 600+ POE modules trying to locate those solutions. Even if they existed.


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://727682]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (6)
As of 2024-03-28 09:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found