Taking nodes from http://groups.drupal.org/node/184984

Create the context
http://www.php.net/manual/en/function.stream-context-create.php
Set to non blocking
http://www.php.net/manual/en/function.stream-set-blocking.php
Open connection
http://www.php.net/manual/en/function.stream-socket-client.php

This will prevent stalls if DNS is taking a long time or if the server went away. Alternative is to have a different timeout for creating the initial connection.

Comments

mikeytown2’s picture

Status: Active » Closed (works as designed)

Thinking about this more and the STREAM_CLIENT_ASYNC_CONNECT flag does what I need to to do.