Пример #1
0
        public Ice.ConnectionInfo GetInfo()
        {
            var    info = new Ice.TCPConnectionInfo();
            Socket?fd   = _stream.Fd();

            if (fd != null)
            {
                EndPoint localEndpoint = Network.GetLocalAddress(fd);
                info.LocalAddress = Network.EndpointAddressToString(localEndpoint);
                info.LocalPort    = Network.EndpointPort(localEndpoint);
                EndPoint?remoteEndpoint = Network.GetRemoteAddress(fd);
                info.RemoteAddress = Network.EndpointAddressToString(remoteEndpoint);
                info.RemotePort    = Network.EndpointPort(remoteEndpoint);
                info.RcvSize       = Network.GetRecvBufferSize(fd);
                info.SndSize       = Network.GetSendBufferSize(fd);
            }
            return(info);
        }
Пример #2
0
        public Ice.ConnectionInfo GetInfo()
        {
            var info = new Ice.UDPConnectionInfo();

            if (_fd != null)
            {
                EndPoint localEndpoint = Network.GetLocalAddress(_fd);
                info.LocalAddress = Network.EndpointAddressToString(localEndpoint);
                info.LocalPort    = Network.EndpointPort(localEndpoint);
                if (_state == StateNotConnected)
                {
                    if (_peerAddr != null)
                    {
                        info.RemoteAddress = Network.EndpointAddressToString(_peerAddr);
                        info.RemotePort    = Network.EndpointPort(_peerAddr);
                    }
                }
                else
                {
                    EndPoint?remoteEndpoint = Network.GetRemoteAddress(_fd);
                    if (remoteEndpoint != null)
                    {
                        info.RemoteAddress = Network.EndpointAddressToString(remoteEndpoint);
                        info.RemotePort    = Network.EndpointPort(remoteEndpoint);
                    }
                }
                info.RcvSize = Network.GetRecvBufferSize(_fd);
                info.SndSize = Network.GetSendBufferSize(_fd);
            }

            if (_mcastAddr != null)
            {
                info.McastAddress = Network.EndpointAddressToString(_mcastAddr);
                info.McastPort    = Network.EndpointPort(_mcastAddr);
            }
            return(info);
        }
Пример #3
0
        public string ToDetailedString()
        {
            var           s = new StringBuilder(ToString());
            List <string> intfs;

            if (_mcastAddr == null)
            {
                intfs = Network.GetHostsForEndpointExpand(Network.EndpointAddressToString(_addr),
                                                          _instance.IPVersion, true);
            }
            else
            {
                Debug.Assert(_mcastInterface != null);
                intfs = Network.GetInterfacesForMulticast(_mcastInterface,
                                                          Network.GetIPVersion(_mcastAddr.Address));
            }

            if (intfs.Count != 0)
            {
                s.Append("\nlocal interfaces = ");
                s.Append(string.Join(", ", intfs.ToArray()));
            }
            return(s.ToString());
        }