<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/transports.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'en',
  ),
  'this' => 
  array (
    0 => 'transports.inet.php',
    1 => 'Internet Domain: TCP, UDP, SSL, and TLS',
    2 => 'Internet Domain: TCP, UDP, SSL, and TLS',
  ),
  'up' => 
  array (
    0 => 'transports.php',
    1 => 'List of Supported Socket Transports',
  ),
  'prev' => 
  array (
    0 => 'transports.php',
    1 => 'List of Supported Socket Transports',
  ),
  'next' => 
  array (
    0 => 'transports.unix.php',
    1 => 'Unix Domain: Unix and UDG',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'appendices/transports.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="transports.inet" class="section">
  <h2 class="title">Internet Domain: TCP, UDP, SSL, and TLS</h2>
  <p class="simpara">
   <code class="literal">ssl://</code>, <code class="literal">tls://</code>,
   <code class="literal">sslv2://</code> &amp; <code class="literal">sslv3://</code>.
  </p>
  <blockquote class="note"><p><strong class="note">Note</strong>: 
   <span class="simpara">
    The <code class="literal">sslv2://</code> and <code class="literal">sslv3://</code> transports
    are obsolete and should not be used. They are documented for
    backward compatibility only.
   </span>
  </p></blockquote>

  <blockquote class="note"><p><strong class="note">Note</strong>: 
   <span class="simpara">
    If no transport is specified, <code class="literal">tcp://</code> will be assumed.
   </span>
  </p></blockquote>

  <ul class="itemizedlist">
   <li class="listitem"><span class="simpara"><code class="literal">127.0.0.1</code></span></li>
   <li class="listitem"><span class="simpara"><code class="literal">fe80::1</code></span></li>
   <li class="listitem"><span class="simpara"><code class="literal">www.example.com</code></span></li>
   <li class="listitem"><span class="simpara"><code class="literal">tcp://127.0.0.1</code></span></li>
   <li class="listitem"><span class="simpara"><code class="literal">tcp://fe80::1</code></span></li>
   <li class="listitem"><span class="simpara"><code class="literal">tcp://www.example.com</code></span></li>
   <li class="listitem"><span class="simpara"><code class="literal">udp://www.example.com</code></span></li>
   <li class="listitem"><span class="simpara"><code class="literal">ssl://www.example.com</code></span></li>
   <li class="listitem"><span class="simpara"><code class="literal">tls://www.example.com</code></span></li>
  </ul>

  <p class="simpara">
   Internet Domain sockets expect a port number in addition
   to a target address.  In the case of <span class="function"><a href="function.fsockopen.php" class="function">fsockopen()</a></span>
   this is specified in a second parameter and therefore does
   not impact the formatting of transport URL.  With
   <span class="function"><a href="function.stream-socket-client.php" class="function">stream_socket_client()</a></span> and related functions
   as with traditional URLs however, the port number is specified
   as a suffix of the transport URL delimited by a colon.
  </p>

  <ul class="itemizedlist">
   <li class="listitem"><span class="simpara"><code class="literal">tcp://127.0.0.1:80</code></span></li>
   <li class="listitem"><span class="simpara"><code class="literal">tcp://[fe80::1]:80</code></span></li>
   <li class="listitem"><span class="simpara"><code class="literal">tcp://www.example.com:80</code></span></li>
  </ul>

  <blockquote class="note"><p><strong class="note">Note</strong>: 
   <strong>IPv6 numeric addresses with port numbers</strong><br />
   <span class="simpara">
    In the second example above, while the IPv4 and hostname
    examples are left untouched apart from the addition of 
    their colon and portnumber, the IPv6 address is wrapped in
    square brackets: <code class="literal">[fe80::1]</code>.  This is to
    distinguish between the colons used in an IPv6 address and
    the colon used to delimit the portnumber.
   </span>
  </p></blockquote>

  <p class="simpara">
   The <code class="literal">ssl://</code> and <code class="literal">tls://</code> transports 
   (available only when openssl support is compiled into PHP) are extensions 
   of the <code class="literal">tcp://</code> transport which include SSL encryption.
  </p>

  <p class="simpara">
   <code class="literal">ssl://</code> will attempt to negotiate a secure SSL/TLS
   connection depending on the capabilities and preferences of both the
   client and the remote host. The actual protocols that may be used are
   determined by the OpenSSL configuration and by any options provided
   through <span class="function"><a href="function.stream-context-create.php" class="function">stream_context_create()</a></span>, such as
   <code class="literal">ssl.crypto_method</code>.
  </p>

  <p class="simpara">
   The SSLv2 and SSLv3 protocols are obsolete and insecure. Their use is
   strongly discouraged and they are no longer enabled by default in
   modern versions of PHP and OpenSSL.
  </p>
 </div><?php manual_footer($setup); ?>