private void CreateNewSocketServer() { _socket = new UnixDomainSocket(); _socket.Bind(_path); _socket.Listen(_backlog); _socket.LingerState.Enabled = false; }
public override Stream Connect(TimeSpan timeout) { string address = GetDefaultAddress(); if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { var namedPipe = new NamedPipeClientStream( ".", address, PipeDirection.InOut, PipeOptions.None, TokenImpersonationLevel.Impersonation); namedPipe.Connect((int)timeout.TotalMilliseconds); return(namedPipe); } else { var socket = new UnixDomainSocket(); socket.Connect(Path.Combine(IpcRootPath, address), timeout); return(new ExposedSocketNetworkStream(socket, ownsSocket: true)); } }
public override async Task <Stream> ConnectAsync(CancellationToken token) { string address = GetDefaultAddress(); if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { var namedPipe = new NamedPipeClientStream( ".", address, PipeDirection.InOut, PipeOptions.None, TokenImpersonationLevel.Impersonation); await namedPipe.ConnectAsync(token).ConfigureAwait(false); return(namedPipe); } else { var socket = new UnixDomainSocket(); await socket.ConnectAsync(Path.Combine(IpcRootPath, address), token).ConfigureAwait(false); return(new ExposedSocketNetworkStream(socket, ownsSocket: true)); } }