/// <summary> /// Gets the interface the connection is using. /// </summary> /// <returns>The <see cref="ICommsInterface"/> which represents the interface the connection is using.</returns> public async Task <ICommsInterface> GetConnectedInterfaceAsync() { var ipEndpoint = (IPEndPoint)_backingTcpClient.Client.LocalEndPoint; var interfaces = await CommsInterface.GetAllInterfacesAsync(); return(interfaces.FirstOrDefault(x => x.NativeIpAddress.Equals(ipEndpoint.Address))); }
/// <summary> /// Returns a <code>CommsInterface</code> wrapper from a platform native <code>NetworkInterface</code>. /// </summary> /// <param name="nativeInterface"></param> /// <returns></returns> public static CommsInterface ToCommsInterfaceSummary(this NetworkInterface nativeInterface) { return(CommsInterface.FromNativeInterface(nativeInterface)); }
/// </summary> /// <returns>The <see cref="ICommsInterface"/> which represents the interface the connection is using.</returns> public async Task <ICommsInterface> GetConnectedInterfaceAsync() { var interfaces = await CommsInterface.GetAllInterfacesAsync(); return(interfaces.FirstOrDefault(x => x.NativeHostName.IsEqual(_backingStreamSocket.Information.LocalAddress))); }