53 public bool Connected => Client?.Connected ??
false;
59 return Client?.ExclusiveAddressUse ??
false;
65 _clientSocket.ExclusiveAddressUse =
value;
122 return Client.LingerState;
124 [param: DisallowNull]
127 Client.LingerState =
value;
135 return Client.NoDelay;
139 Client.NoDelay =
value;
183 if (hostname ==
null)
209 public void Connect(
string hostname,
int port)
212 if (hostname ==
null)
240 socket.DualMode =
true;
249 socket.
Connect(iPAddress, port);
278 exceptionDispatchInfo?.
Throw();
302 if (remoteEP ==
null)
306 Client.Connect(remoteEP);
307 _family = Client.AddressFamily;
313 Client.Connect(ipAddresses, port);
314 _family = Client.AddressFamily;
372 return Client.BeginConnect(address, port, requestCallback,
state);
377 return Client.BeginConnect(host, port, requestCallback,
state);
382 return Client.BeginConnect(addresses, port, requestCallback,
state);
410 protected virtual void Dispose(
bool disposing)
417 if (dataStream !=
null)
469 ThrowObjectDisposedException();
471 void ThrowObjectDisposedException()
static void SuppressFinalize(object obj)
static IPAddress[] GetHostAddresses(string hostNameOrAddress)
AddressFamily AddressFamily
override AddressFamily AddressFamily
static readonly System.Net.NetEventSource Log
static void Info(object thisOrContextObject, FormattableString formattableString=null, [CallerMemberName] string memberName=null)
static bool OSSupportsIPv6
AddressFamily AddressFamily
virtual void Dispose(bool disposing)
static bool OSSupportsIPv4
void Bind(EndPoint localEP)
void Connect(EndPoint remoteEP)
void InternalShutdown(SocketShutdown how)
void EndConnect(IAsyncResult asyncResult)
IAsyncResult BeginConnect(string host, int port, AsyncCallback? requestCallback, object? state)
async ValueTask CompleteConnectAsync(ValueTask task)
IAsyncResult BeginConnect(IPAddress address, int port, AsyncCallback? requestCallback, object? state)
ValueTask ConnectAsync(IPAddress[] addresses, int port, CancellationToken cancellationToken)
ValueTask ConnectAsync(IPAddress address, int port, CancellationToken cancellationToken)
async Task CompleteConnectAsync(Task task)
TcpClient(IPEndPoint localEP)
virtual void Dispose(bool disposing)
NetworkStream GetStream()
Task ConnectAsync(IPAddress[] addresses, int port)
void InitializeClientSocket()
ValueTask ConnectAsync(string host, int port, CancellationToken cancellationToken)
void Connect(IPEndPoint remoteEP)
TcpClient(string hostname, int port)
void Connect(IPAddress[] ipAddresses, int port)
void EndConnect(IAsyncResult asyncResult)
TcpClient(Socket acceptedSocket)
Task ConnectAsync(IPAddress address, int port)
Task ConnectAsync(IPEndPoint remoteEP)
Task ConnectAsync(string host, int port)
LingerOption? LingerState
void Connect(IPAddress address, int port)
void Connect(string hostname, int port)
IAsyncResult BeginConnect(IPAddress[] addresses, int port, AsyncCallback? requestCallback, object? state)
ValueTask ConnectAsync(IPEndPoint remoteEP, CancellationToken cancellationToken)
NetworkStream _dataStream
TcpClient(AddressFamily family)
static bool ValidatePortNumber(int port)
static ExceptionDispatchInfo Capture(Exception source)
static string net_protocol_invalid_family
static string Format(string resourceFormat, object p1)
static string net_notconnected
static int CompareExchange(ref int location1, int value, int comparand)
static int Exchange(ref int location1, int value)
new ConfiguredTaskAwaitable< TResult > ConfigureAwait(bool continueOnCapturedContext)
static bool Read(ref bool location)
ConfiguredValueTaskAwaitable ConfigureAwait(bool continueOnCapturedContext)