当前位置:编程学习 > C#/ASP.NET >>

非常急,使用OpenNETCF.Net的ConnectToPreferredNetwork方法连接wifi成功,但是一段时间后自动关闭

我要做的是一个wince 上的wifi连接工具,采用的是OpenNETCF.Net库
通过下面的代码能够连上,而且ip也设置成功,但是过了大约10多秒钟之后wifi显示断开
ping也ping不通,这是为什么啊

我的代码如下

AccessPoint ap=xx(太过复杂省略获取过程)

  if (ap.Privacy != WEPStatus.WEPDisabled)
                            {

                                string password = AccessPointForm.StrToHex(tree.Password);//密码转换

                                EAPParameters eap = new EAPParameters();
                                eap.Enable8021x = false;
                                eap.AuthData = IntPtr.Zero;
                                eap.AuthDataLen = 0;
                                eap.EapType = EAPType.PEAP;
                                eap.EapFlags = EAPFlags.Enabled;
                                if (m_wzc.AddPreferredNetwork(ap.Name, true, password, 1, ap.AuthenticationMode, ap.Privacy, eap))//添加进预设网络列表中
                                {
                                    if (m_wzc.ConnectToPreferredNetwork(ap.Name))//连接热点
                                    {
                                        //修改ip
                                        m_wzc.GetIPProperties().GetIPv4Properties().IsDhcpEnabled = tree.DHCP;
                                        m_wzc.CurrentIpAddress = System.Net.IPAddress.Parse(tree.IP);
                                        m_wzc.CurrentSubnetMask = System.Net.IPAddress.Parse(tree.Sub);
                                        m_wzc.GetIPProperties().GatewayAddresses.Add(System.Net.IPAddress.Parse(tree.Gate));
                                        m_wzc.GetIPProperties().DnsAddresses.Add(System.Net.IPAddress.Parse(tree.DNS));
                                        m_wzc.Bind();
                                    }
                                }
                            }
--------------------编程问答-------------------- up/........................ --------------------编程问答-------------------- up~~~~~~~~~~~~ --------------------编程问答-------------------- 帮顶~~~~~~~~~~~~~~~ --------------------编程问答-------------------- 楼主搞定了没? --------------------编程问答-------------------- 楼主搞定没?我想问下,在wince下,accesspoint并没有authenticationmode属性,可是你在上面怎么用到了呢?
--------------------编程问答-------------------- 因为通过这个方法热点连接的网络 会将“这是一个隐藏网络”勾选,还在找解决办法。
补充:.NET技术 ,  C#
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,