Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Timeout for an established connection

by BrowserUk (Patriarch)
on Dec 31, 2012 at 13:54 UTC ( [id://1011063]=note: print w/replies, xml ) Need Help??


in reply to Timeout for an established connection

how i can set the timeout for an established connection, which I can not get the data for a long time?

Warning: I've never used IO::Poll. But...

surely the point of polling, is that you only attempt to do a recv(), when you know there is something available.

And when something is available, you recv() just what is available, which means the recv() will complete immediately.

So please explain what you mean by which I can not get the data for a long time"? (The somewhat tortured grammar makes that unclear),

And explain again, why do you need to set a timeout?


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
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.

Replies are listed 'Best First'.
Re^2: Timeout for an established connection
by 0day (Sexton) on Jan 01, 2013 at 12:14 UTC
    Ok.
    There is a spider that walks the http links. Spider has a limited number of connections, let it be 10.
    If we run this spider and he will eat 10 such references (http://stockzooi.com/), then it stops working.
    Because IO::Poll, as well as IO::Selekt not notified about the data recv.

    Connection occurs. The data is sent. No response from the server.

    On my computer, the browser tries to open this site 24 hours.
    If the connections is the only one we can close it when the IO::Poll returns zero (timeout).
    But this did not happen, because the remaining 9 connections will be processed normally. Soon the spider will eat one same link. Working connections will remain 8.
    Etc.

      Okay, that explains the problem you are trying to deal with. Ie: when a server accepts a request ($svr->send( GET ... )), but never actually responds.

      By default, the connection will remain open for something like 900 seconds. The solution is to use setsockopt() to set the TCP_USER_TIMEOUT.

      A search for that term will turn up the relevant docs.


      With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
      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.
        Thanks... but, unfortunately I did not find this flag in perl modules.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1011063]
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-19 02:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found