1
0
Fork 0
pull/180/merge
Felix Becker 2016-11-23 18:08:22 +00:00 committed by GitHub
commit e066fac7f8
2 changed files with 20 additions and 0 deletions

View File

@ -148,6 +148,16 @@ Example:
php bin/php-language-server.php --tcp=127.0.0.1:12345
#### `--tcp-server=host:port` (optional)
Causes the server to use a tcp connection for communicating with the language client instead of using STDIN/STDOUT.
The server will listen on the given address for a connection.
It will only accept one connection and the connection cannot be reestablished once closed, spawn a new process instead.
Strongly recommended on Windows because of blocking STDIO.
Example:
php bin/php-language-server.php --tcp-server=127.0.0.1:12345
#### `--memory-limit=integer` (optional)
Sets memory limit for language server.
Equivalent to [memory-limit](http://php.net/manual/en/ini.core.php#ini.memory-limit) php.ini directive.

View File

@ -39,6 +39,16 @@ if (!empty($options['tcp'])) {
exit(1);
}
$inputStream = $outputStream = $socket;
} else if (!empty($options['tcp-server'])) {
$address = $options['tcp-server'];
$tcpServer = stream_socket_server('tcp://' . $address, $errno, $errstr);
if ($socket === false) {
fwrite(STDERR, "Could not listen on $address. Error $errno\n");
fwrite(STDERR, "$errstr\n");
exit(1);
}
$socket = stream_socket_accept($tcpServer);
$inputStream = $outputStream = $socket;
} else {
$inputStream = STDIN;
$outputStream = STDOUT;