|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits              [2019-11-17 12:33 UTC] vibbow at hotmail dot com
  [2019-11-17 13:40 UTC] cmb@php.net
 
-Status:      Open
+Status:      Feedback
-Package:     Sockets related
+Package:     Performance problem
-Assigned To:
+Assigned To: cmb
  [2019-11-17 13:40 UTC] cmb@php.net
  [2019-11-17 13:44 UTC] vibbow at hotmail dot com
  [2019-11-17 13:48 UTC] vibbow at hotmail dot com
  [2019-11-17 22:42 UTC] cmb@php.net
 
-Status: Feedback
+Status: Open
  [2019-11-18 12:35 UTC] cmb@php.net
  [2019-11-18 15:22 UTC] vibbow at hotmail dot com
  [2019-11-18 19:26 UTC] vibbow at hotmail dot com
  [2019-11-18 19:41 UTC] vibbow at hotmail dot com
  [2019-11-18 19:51 UTC] vibbow at hotmail dot com
  [2019-11-18 23:03 UTC] vibbow at hotmail dot com
  [2019-12-23 12:02 UTC] vibbow at hotmail dot com
  [2019-12-23 12:21 UTC] cmb@php.net
  [2019-12-23 12:24 UTC] vibbow at hotmail dot com
  [2020-01-02 12:34 UTC] cmb@php.net
 
-Status:      Assigned
+Status:      Verified
-Assigned To: cmb
+Assigned To:
  [2020-01-02 12:34 UTC] cmb@php.net
  [2020-01-02 12:39 UTC] vibbow at hotmail dot com
  [2020-01-02 16:32 UTC] cmb@php.net
  [2020-01-09 13:58 UTC] vibbow at hotmail dot com
  [2020-01-09 14:43 UTC] vibbow at hotmail dot com
  [2020-01-18 17:50 UTC] vibbow at hotmail dot com
 
-Summary:     stream_socket_client works slower than except
+Summary:     stream_socket_client works slower than expect
-PHP Version: 7.3.11
+PHP Version: 7.4.1
  [2020-01-18 17:50 UTC] vibbow at hotmail dot com
  [2020-11-17 07:29 UTC] vibbow at hotmail dot com
 
-PHP Version: 7.4.1
+PHP Version: 7.4.12
  [2020-11-17 07:29 UTC] vibbow at hotmail dot com
  [2020-11-17 07:34 UTC] vibbow at hotmail dot com
 
-PHP Version: 7.4.12
+PHP Version: 8.0.0 RC4
  [2020-11-17 07:34 UTC] vibbow at hotmail dot com
  [2021-07-22 18:19 UTC] vibbow at hotmail dot com
 
-PHP Version: 8.0.0 RC4
+PHP Version: 8.1.0 Beta1
  [2021-07-22 18:19 UTC] vibbow at hotmail dot com
 | |||||||||||||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 13:00:01 2025 UTC | 
Description: ------------ In my test script, I use two method to create a tcp connection (to another pc in LAN), one is socket_connect, another is stream_socket_client. Since those two code snips doing the same thing, they should have same time cost. But on Windows platform, stream_socket_client are must slower than except. socket_create are using less 1ms in average, stream_socket_client are using around 10ms in average. Can be reproduced from PHP 7.1 to 7.3 Can be reproduced on Windows 2019 & Windows 10 1909. Test script: --------------- <?php $begin = microtime(true); $socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); socket_connect($socket, '192.168.163.110', 6379); $end = microtime(true); echo ($end - $begin) * 1000 . PHP_EOL; $begin = microtime(true); $fp = stream_socket_client("tcp://192.168.163.110:6379"); $end = microtime(true); echo ($end - $begin) * 1000 . PHP_EOL; Expected result: ---------------- socket_create & stream_socket_client should use similier time cost Actual result: -------------- D:\Websites>php test.php 1.1060237884521 10.412216186523 stream_socket_client use 10 times time than socket_create