Exemplo n.º 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);
        }
Exemplo n.º 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);
        }