44 *
55 * PHP Version 4
66 *
7- * Copyright (c) 1997-2003 The PHP Group
7+ * Copyright (c) 1997-2013 The PHP Group
88 *
99 * This source file is subject to version 2.0 of the PHP license,
1010 * that is bundled with this package in the file LICENSE, and is
2323 * @author Chuck Hagenbuch <chuck@horde.org>
2424 * @copyright 1997-2003 The PHP Group
2525 * @license http://www.php.net/license/2_02.txt PHP 2.02
26- * @version CVS: $Id$
2726 * @link http://pear.php.net/packages/Net_Socket
2827 */
2928
@@ -100,7 +99,7 @@ class Net_Socket extends PEAR
10099 * Connect to the specified port. If called when the socket is
101100 * already connected, it disconnects and connects again.
102101 *
103- * @param string $addr IP address or host name.
102+ * @param string $addr IP address or host name (may be with protocol prefix) .
104103 * @param integer $port TCP port number.
105104 * @param boolean $persistent (optional) Whether the connection is
106105 * persistent (kept open between requests
@@ -110,7 +109,7 @@ class Net_Socket extends PEAR
110109 *
111110 * @access public
112111 *
113- * @return boolean | PEAR_Error True on success or a PEAR_Error on failure.
112+ * @return boolean| PEAR_Error True on success or a PEAR_Error on failure.
114113 */
115114 function connect ($ addr , $ port = 0 , $ persistent = null ,
116115 $ timeout = null , $ options = null )
@@ -122,11 +121,10 @@ function connect($addr, $port = 0, $persistent = null,
122121
123122 if (!$ addr ) {
124123 return $ this ->raiseError ('$addr cannot be empty ' );
125- } elseif (strspn ($ addr , ':.0123456789 ' ) == strlen ($ addr ) ||
126- strstr ($ addr , '/ ' ) !== false ) {
124+ } else if (strspn ($ addr , ':.0123456789 ' ) == strlen ($ addr )) {
127125 $ this ->addr = strpos ($ addr , ': ' ) !== false ? '[ ' .$ addr .'] ' : $ addr ;
128126 } else {
129- $ this ->addr = @ gethostbyname ( $ addr) ;
127+ $ this ->addr = $ addr ;
130128 }
131129
132130 $ this ->port = $ port % 65536 ;
0 commit comments