Skip to content

Instantly share code, notes, and snippets.

@yasudacloud
Created September 2, 2022 16:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yasudacloud/76cd5de2755fde0682064e8d08b696ff to your computer and use it in GitHub Desktop.
Save yasudacloud/76cd5de2755fde0682064e8d08b696ff to your computer and use it in GitHub Desktop.
<?php
$address = "unix://\0testtest";
$socket = stream_socket_server($address, $errorCode, $errorMessage);
if (!$socket) {
throw new Exception('Failed Socket Server');
}
while ($conn = stream_socket_accept($socket, 65535)) {
print("@receive");
fwrite($conn, 'Server Message' . "\n");
fclose($conn);
}
fclose($socket);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment