Table of Contents

Class ClientSocketFactory

Namespace
VpnHood.Core.Client
Assembly
VpnHood.Core.Client.dll

The VPN client's factory made of a socket factory and the platform's QUIC.

public class ClientSocketFactory : IClientSocketFactory, ISocketFactory
Inheritance
ClientSocketFactory
Implements
Inherited Members

Constructors

ClientSocketFactory(ISocketFactory, IQuicClientFactory?)

The VPN client's factory made of a socket factory and the platform's QUIC.

public ClientSocketFactory(ISocketFactory socketFactory, IQuicClientFactory? quicClientFactory)

Parameters

socketFactory ISocketFactory

Creates the sockets.

quicClientFactory IQuicClientFactory

The platform's QUIC, or null where it has none.

Properties

QuicClientFactory

Gets the platform's QUIC, or null where it has none: the client then keeps to TCP.

public IQuicClientFactory? QuicClientFactory { get; }

Property Value

IQuicClientFactory

Methods

CreateTcpClient(IPEndPoint, TcpClientOptions?)

Creates a TCP client for an endpoint's address family, not connected yet.

public TcpClient CreateTcpClient(IPEndPoint ipEndPoint, TcpClientOptions? options = null)

Parameters

ipEndPoint IPEndPoint

The endpoint the client will connect to; its address family is the client's.

options TcpClientOptions

The client's options, or null for the defaults.

Returns

TcpClient

The TCP client, which the caller owns and disposes.

Remarks

It is the socket factory's.

CreateUdpClient(AddressFamily)

Creates a UDP client of an address family.

public UdpClient CreateUdpClient(AddressFamily addressFamily)

Parameters

addressFamily AddressFamily

The address family.

Returns

UdpClient

The UDP client, which the caller owns and disposes.

Remarks

It is the socket factory's.

CreateUdpSocket(AddressFamily)

Creates a UDP socket of an address family, for a worker that manages its own receive buffer.

public Socket CreateUdpSocket(AddressFamily addressFamily)

Parameters

addressFamily AddressFamily

The address family.

Returns

Socket

The socket, which the caller owns and disposes.

Remarks

A UdpClient keeps a receive buffer of its own, too costly for small-buffer workers such as DNS. The interface's default implementation returns the socket of CreateUdpClient(AddressFamily), so a factory that does not implement it keeps its protection, binding and configuration.