1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

fsockopen doesn't timeout

Discussion in 'PHP' started by thuankkk, Mar 1, 2010.

  1. #1
    UPDATED: Thanks, found the cause: gethostbyname takes a lot of time. Thread should be closed.

    Hello,

    I have a piece like this
    $f=fsockopen($ip, $port, $errno, $errstr, $timeout);

    I set $timeout=3, but sometimes fsockopen doesn't timeout.
    It hangs until the connection is created, and takes about 5 - 25 seconds.

    I already set the default_socket_timeout=3 using ini_set();

    Can you guys help me please :)
     
    Last edited: Mar 1, 2010
    thuankkk, Mar 1, 2010 IP
  2. szalinski

    szalinski Peon

    Messages:
    341
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #2
    so is the solution to not use gethostbyname, or what did you do to solve the problem?
     
    szalinski, Mar 1, 2010 IP