Ejemplo n.º 1
0
        public HResult Open(string ip, int port)
        {
            try
            {
                ThrowIfError(CheckShutdown());

                _networkSender.Connect(ip, port);
                _networkSender.Start();
                SendDescribeRequest();

                return(HResult.S_OK);
            }
            catch (SocketException sex)
            {
                switch (sex.NativeErrorCode)
                {
                case 10060:
                    return(HResult.MF_E_NET_TIMEOUT);

                case 10061:
                    return(HResult.MF_E_NET_REDIRECT);

                default:
                    return(HResult.MF_E_NETWORK_RESOURCE_FAILURE);
                }
            }
            catch (Exception ex)
            {
                return(HResult.MF_E_NETWORK_RESOURCE_FAILURE);
            }
        }