@@ -21,7 +21,7 @@ class Socket extends AConnection
2121 */
2222 private $ socket = false ;
2323
24- private const RESOURCE_UNAVAILABLE_CODE = [11 , 10060 ];
24+ private const POSSIBLE_TIMEOUTS_CODES = [11 , 10060 ];
2525 /** @var float|null */
2626 private $ timetAtTimeoutConfiguration ;
2727
@@ -76,7 +76,7 @@ public function write(string $buffer)
7676 $ this ->printHex ($ buffer );
7777
7878 while (0 < $ size ) {
79- $ sent = socket_write ($ this ->socket , $ buffer , $ size );
79+ $ sent = @ socket_write ($ this ->socket , $ buffer , $ size );
8080 if ($ sent === false ) {
8181 $ this ->throwConnectException ();
8282 }
@@ -101,7 +101,7 @@ public function read(int $length = 2048): string
101101 }
102102
103103 do {
104- $ readed = socket_read ($ this ->socket , $ length - mb_strlen ($ output , '8bit ' ), PHP_BINARY_READ );
104+ $ readed = @ socket_read ($ this ->socket , $ length - mb_strlen ($ output , '8bit ' ), PHP_BINARY_READ );
105105 if ($ readed === false ) {
106106 $ this ->throwConnectException ();
107107 }
@@ -148,7 +148,7 @@ private function configureTimeout(): void
148148 private function throwConnectException (): void
149149 {
150150 $ code = socket_last_error ($ this ->socket );
151- if (in_array ($ code , self ::RESOURCE_UNAVAILABLE_CODE )) {
151+ if (in_array ($ code , self ::POSSIBLE_TIMEOUTS_CODES )) {
152152 $ timediff = microtime (true ) - $ this ->timetAtTimeoutConfiguration ;
153153 if ($ timediff >= $ this ->timeout ) {
154154 throw ConnectionTimeoutException::createFromTimeout ($ this ->timeout );
0 commit comments