public ValueTask <IConnectionListener> BindAsync(EndPoint endpoint, CancellationToken cancellationToken = default) { var unixEndpoint = new UnixDomainSocketEndPoint(socketConnectionOptions.ConvertEndpointToPath(endpoint)); var listener = new UnixSocketConnectionListener(unixEndpoint, endpoint, this.socketConnectionOptions, this.trace, this.schedulers); listener.Bind(); return(new ValueTask <IConnectionListener>(listener)); }
public async ValueTask <ConnectionContext> ConnectAsync(EndPoint endpoint, CancellationToken cancellationToken = default) { var socket = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.Unspecified); var unixEndpoint = new UnixDomainSocketEndPoint(socketConnectionOptions.ConvertEndpointToPath(endpoint)); await socket.ConnectAsync(unixEndpoint); var scheduler = this.schedulers.GetScheduler(); var connection = new SocketConnection(socket, memoryPool, scheduler, trace); connection.Start(); return(connection); }