function CheckNetWorkStaus(tabSize)
	if tabSize == nil then
		return nil
	end
	local Obj = XLGetObject("Xunlei.OSShell.Obj")
	local bret, dwflag = Obj:GetConnectedState()	
	if bret ==nil or dwflag ==nil then return nil end
	
	local seg = Obj:GetTcpStatInSegs()
	
	local result = 1 
	local idTab = {}
	if bret == true then
		local addrTab1 = {"ping1.client.sandai.net", "ping2.client.sandai.net", "ping3.client.sandai.net", 
										 "ping4.client.sandai.net", "ping5.client.sandai.net", "ping6.client.sandai.net"}
		local index = Obj:Rand(6)
		for i=index+1,index+4 do
			local tmp = i
			if tmp>#addrTab1 then
				tmp = tmp - #addrTab1 + 1
			end

			local id = Obj:AsynPing(addrTab1[tmp])
			table.insert(idTab, id)
		end
  end
  
  for i=1,10 do
  	Obj:Sleep(1000)
  	for j=1,#idTab do
  		local state = Obj:GetAsynPingResult(idTab[j])
  		if state==2 then
  			return 0
  		elseif state==1 then
  			table.remove(idTab, j)
  		end
  		
  		if #idTab==j then
  			break
  		end
  	end
  	
  	if #idTab==0 then
  		break
  	end
  end

	local seg2 = Obj:GetTcpStatInSegs()
	if seg2~=seg then
		return 0
	end
	
	return 1
end

function CanConnect(tab)
	if tab == nil then 
		return nil
	end
	local Obj = XLGetObject("Xunlei.OSShell.Obj")
	local result = 1
	for i=1, 4 do 
		local ret = Obj:Ping(tab['rule@']['addr'])
		if  ret == true then
			result = 0
			break
		end	
	end
	return result 
end

function PortTest(tab)
	if tab == nil then 
		return nil
	end
	local Obj = XLGetObject("Xunlei.OSShell.Obj")
	local result = 0
	if  Obj:CheckSocketConnect(tab['rule@']['addr'], tab['rule@']['port']) == false then 
		result = 1
	end 
	--XLMessageBox("result  = "..tostring(result))
	
	return result
end

function DNSTest(tab)
	--XLMessageBox("11")
	if tab == nil then 
		return nil
	end
	local Obj = XLGetObject("Xunlei.OSShell.Obj")
	local result = 0	
	if  Obj:CheckDNS(tab['rule@']['addr']) == false then
		result = 1
		local objStat = XLGetObject("XLDoctor.StatHelper.Obj")
		objStat:AddStatStrVal("xldoctor|DNS|checkfailed", Obj:GetDnsIP())
	end
	return result
end