mirror of
https://github.com/aspnet/JavaScriptServices.git
synced 2025-12-23 18:19:40 +00:00
30 lines
827 B
C#
30 lines
827 B
C#
using System;
|
|
using System.IO;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Microsoft.AspNetCore.NodeServices.HostingModels.PhysicalConnections
|
|
{
|
|
internal abstract class StreamConnection : IDisposable
|
|
{
|
|
public abstract Task<Stream> Open(string address);
|
|
public abstract void Dispose();
|
|
|
|
public static StreamConnection Create()
|
|
{
|
|
#if NET451
|
|
return new NamedPipeConnection();
|
|
#else
|
|
var useNamedPipes = System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(
|
|
System.Runtime.InteropServices.OSPlatform.Windows);
|
|
if (useNamedPipes)
|
|
{
|
|
return new NamedPipeConnection();
|
|
}
|
|
else
|
|
{
|
|
return new UnixDomainSocketConnection();
|
|
}
|
|
#endif
|
|
}
|
|
}
|
|
} |