@@ -598,10 +598,15 @@ public function writeBuffer($resource, string $string): int
598
598
*/
599
599
private function openIPCSocket (string $ ipcSocketPath ): void
600
600
{
601
- if (file_exists ($ ipcSocketPath )) {
602
- unlink ($ ipcSocketPath );
603
- }
604
- $ this ->icpSocket = socket_create (AF_UNIX , SOCK_DGRAM , 0 );
601
+ if (substr (php_uname (), 0 , 7 ) == "Windows " ){
602
+ $ this ->icpSocket = socket_create (AF_INET , SOCK_DGRAM , 0 );
603
+ $ ipcSocketPath = $ this ->host ;
604
+ } else {
605
+ if (file_exists ($ ipcSocketPath )) {
606
+ unlink ($ ipcSocketPath );
607
+ }
608
+ $ this ->icpSocket = socket_create (AF_UNIX , SOCK_DGRAM , 0 );
609
+ }
605
610
if ($ this ->icpSocket === false ) {
606
611
throw new \RuntimeException ('Could not open ipc socket. ' );
607
612
}
@@ -630,7 +635,13 @@ private function openIPCSocket(string $ipcSocketPath): void
630
635
private function handleIPC (): void
631
636
{
632
637
$ buffer = '' ;
633
- $ bytesReceived = socket_recvfrom ($ this ->icpSocket , $ buffer , 65536 , 0 , $ this ->ipcSocketPath );
638
+ if (substr (php_uname (), 0 , 7 ) == "Windows " ) {
639
+ $ from = '' ;
640
+ $ port = 0 ;
641
+ $ bytesReceived = socket_recvfrom ($ this ->icpSocket , $ buffer , 65536 , 0 , $ from , $ port );
642
+ } else {
643
+ $ bytesReceived = socket_recvfrom ($ this ->icpSocket , $ buffer , 65536 , 0 , $ this ->ipcSocketPath );
644
+ }
634
645
if ($ bytesReceived === false ) {
635
646
return ;
636
647
}
0 commit comments