| @@ 131-139 (lines=9) @@ | ||
| 128 | * |
|
| 129 | * @return bool <p>Returns <code>true</code> if the bind was successful.</p> |
|
| 130 | */ |
|
| 131 | public function bind($address, $port = 0) |
|
| 132 | { |
|
| 133 | return static::exceptionOnFalse( |
|
| 134 | $this->resource, |
|
| 135 | function ($resource) use ($address, $port) { |
|
| 136 | return @socket_bind($resource, $address, $port); |
|
| 137 | } |
|
| 138 | ); |
|
| 139 | } |
|
| 140 | ||
| 141 | /** |
|
| 142 | * Close the socket. |
|
| @@ 175-183 (lines=9) @@ | ||
| 172 | * |
|
| 173 | * @return bool <p>Returns <code>true</code> if the connect was successful. |
|
| 174 | */ |
|
| 175 | public function connect($address, $port = 0) |
|
| 176 | { |
|
| 177 | return static::exceptionOnFalse( |
|
| 178 | $this->resource, |
|
| 179 | function ($resource) use ($address, $port) { |
|
| 180 | return @socket_connect($resource, $address, $port); |
|
| 181 | } |
|
| 182 | ); |
|
| 183 | } |
|
| 184 | ||
| 185 | /** |
|
| 186 | * Build Socket objects based on an array of php socket resources. |
|