mirror of
https://github.com/YGGverse/net-php.git
synced 2026-03-31 17:15:35 +00:00
add connection close
This commit is contained in:
parent
a64b7ac816
commit
cc9ddf3647
1 changed files with 13 additions and 8 deletions
|
|
@ -36,15 +36,20 @@ class Socket
|
||||||
{
|
{
|
||||||
if (self::isHost($host) && self::isPort($port))
|
if (self::isHost($host) && self::isPort($port))
|
||||||
{
|
{
|
||||||
return is_resource(
|
$connection = @fsockopen(
|
||||||
@fsockopen(
|
|
||||||
$host,
|
$host,
|
||||||
$port,
|
$port,
|
||||||
$error_code,
|
$error_code,
|
||||||
$error_message,
|
$error_message,
|
||||||
$timeout
|
$timeout
|
||||||
)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (is_resource($connection))
|
||||||
|
{
|
||||||
|
return fclose(
|
||||||
|
$connection
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue