Class BindingSocketFactory
Provides the sockets of another factory, each bound to an ephemeral port on all interfaces where that factory left it unbound.
public class BindingSocketFactory : ISocketFactory
- Inheritance
-
BindingSocketFactory
- Implements
- Inherited Members
Constructors
BindingSocketFactory(ISocketFactory)
Provides the sockets of another factory, each bound to an ephemeral port on all interfaces where that factory left it unbound.
public BindingSocketFactory(ISocketFactory socketFactory)
Parameters
socketFactoryISocketFactoryThe factory that makes the sockets.
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
ipEndPointIPEndPointThe endpoint the client will connect to; its address family is the client's.
optionsTcpClientOptionsThe client's options, or null for the defaults.
Returns
- TcpClient
The TCP client, which the caller owns and disposes.
Remarks
It binds the client, where it is unbound, on the endpoint's IP version.
Exceptions
- Exception
The factory gave a client without a socket.
CreateUdpClient(AddressFamily)
Creates a UDP client of an address family.
public UdpClient CreateUdpClient(AddressFamily addressFamily)
Parameters
addressFamilyAddressFamilyThe address family.
Returns
- UdpClient
The UDP client, which the caller owns and disposes.
Remarks
It binds the client, where it is unbound.
Exceptions
- Exception
The factory gave a client without a socket.
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
addressFamilyAddressFamilyThe 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.