Ejemplo n.º 1
0
        /// <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)));
        }
Ejemplo n.º 2
0
 /// <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));
 }
Ejemplo n.º 3
0
        /// </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)));
        }