public static void ListenNamedPipe(this KestrelServerOptions serverOptions, NamedPipeEndPoint endPoint)
        {
            var listenOptions    = (ListenOptions)FormatterServices.GetUninitializedObject(typeof(ListenOptions));
            var endPointProperty = listenOptions.GetType().GetProperty("EndPoint");

            endPointProperty.SetValue(listenOptions, endPoint);
            ((List <ListenOptions>)serverOptions.GetType().GetProperty("ListenOptions", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(serverOptions)).Add(listenOptions);
            return;
        }
Esempio n. 2
0
        public ValueTask <IConnectionListener> BindAsync(EndPoint endpoint, CancellationToken cancellationToken = default)
        {
            var namedPipeEndPoint = endpoint as NamedPipeEndPoint;

            if (namedPipeEndPoint == null)
            {
                namedPipeEndPoint = new NamedPipeEndPoint("13f10fec-abcf-4f01-be97-2003f870600e");
            }

            var transport = new NamedPipeConnectionListener(namedPipeEndPoint);

            return(new ValueTask <IConnectionListener>(transport));
        }
Esempio n. 3
0
        public HttpClientProtocol(ConnectionContext connection)
        {
            _connection = connection;
            _reader     = connection.CreateReader();

            (string host, int port) = connection.RemoteEndPoint switch
            {
                UriEndPoint uriEndPoint => (uriEndPoint.Uri.Host, uriEndPoint.Uri.Port),
                IPEndPoint ip => (ip.Address.ToString(), ip.Port),
                NamedPipeEndPoint np => (np.PipeName, 80),
                _ => throw new NotSupportedException($"{connection.RemoteEndPoint} not supported")
            };
            _messageWriter = new Http1RequestMessageWriter(host, port);
        }
Esempio n. 4
0
 public PipeClient(ServerEndPoint endpoint, ILoggerFactory loggerFactory)
 {
     _endpoint      = (NamedPipeEndPoint)endpoint.EndPoint;
     ServerEndPoint = endpoint;
     _loggerFactory = loggerFactory;
 }
 public NamedPipeConnectionListener(NamedPipeEndPoint namedPipeEndPoint)
 {
     _namedPipeEndPoint = namedPipeEndPoint;
     ListeningToken     = _listeningSource.Token;
 }