Merge pull request #291 from BBasile/fix-unixdomain-win

fix, win version broken, unix domain socket code defined in a runtime branch
This commit is contained in:
Brian Schott 2016-02-03 12:51:56 -08:00
commit 9e109d5051
1 changed files with 6 additions and 2 deletions

View File

@ -209,6 +209,7 @@ bool serverIsRunning(bool useTCP, string socketFile, ushort port)
socket.shutdown(SocketShutdown.BOTH);
socket.close();
}
version(Windows) useTCP = true;
if (useTCP)
{
socket = new TcpSocket(AddressFamily.INET);
@ -216,8 +217,11 @@ bool serverIsRunning(bool useTCP, string socketFile, ushort port)
}
else
{
socket = new Socket(AddressFamily.UNIX, SocketType.STREAM);
socket.connect(new UnixAddress(socketFile));
version(Windows) {} else
{
socket = new Socket(AddressFamily.UNIX, SocketType.STREAM);
socket.connect(new UnixAddress(socketFile));
}
}
socket.setOption(SocketOptionLevel.SOCKET, SocketOption.RCVTIMEO, dur!"seconds"(5));
socket.blocking = true;