For $ss = 0 To UBound($OnlineList) - 1
$sRecv = TCPRecv($OnlineList[$ss][0], 2048, 1)
If $sRecv <> "" Then
$daet = BinaryToString($sRecv, 4)
If StringLeft($daet, 1) = "*" And StringRight($daet, 1) = "*" Then
$SD = StringSplit($daet, "|", 2)
Select
Case $SD[1] = 0 ;查询数据 并返回
$iIndex = _ArraySearch($Verified, 0, 0, 0, 0, 1, 1, 1)
;~ $iIndex = _ArrayFindAll($Verified, 0, 0, 0, 0, 1, 1)
If @error Then
_ArraySort($Verified, 0, 0, 0, 1)
For $si1 = 0 To UBound($Verified) - 1
If $Verified[$si1][2] > 3 Then
_ArrayDelete($Verified, $si1)
ExitLoop
Else
$Verified[$si1][1] = 0
EndIf
Next
Else
$Verified[$iIndex][1] = 1
$sMsg = StringToBinary("*|" & $Verified[$iIndex][0] & "|" & $Verified[$iIndex][2] & "|" & $Verified[$iIndex][3] & "|" & $ver & "|" & $http & "|*", 4)
TCPSend($OnlineList[$ss][0], $sMsg)
EndIf
Case $SD[1] = 1
;~ $iIndex = _ArrayFindAll($Verified, $SD[3], 0, 0, 0, 1, 0)
$iIndex = _ArraySearch($Verified, $SD[3], 0, 0, 0, 1, 1, 0)
If @error Then
Else
$Verified[$iIndex][2] = $SD[2]
EndIf
Case $SD[1] = 2
$iIndex = _ArraySearch($Verified, $SD[3], 0, 0, 0, 1, 1, 0)
If @error Then
$all = UBound($Verified) + 1
ReDim $Verified[$all][4]
$Verified[$all - 1][0] = $SD[3]
$Verified[$all - 1][1] = 0
$Verified[$all - 1][2] = 0
$Verified[$all - 1][3] = 0
EndIf
Case $SD[1] = 3
If UBound($avArray) > 1 Then
$sMsg = StringToBinary($avArray[0] & "*|" & $avArray[0] & "|0|0|0|0|*", 4)
TCPSend($OnlineList[$ss][0], $sMsg)
_ArrayDelete($avArray, 0)
Else
If $ll = 0 Then
$ll = 1
$Timer = DllCallbackRegister("_tianjia", "int", "hwnd;uint;uint;dword")
$TimerDLL = DllCall("user32.dll", "uint", "SetTimer", "hwnd", 0, "uint", 0, "int", 10000, "ptr", DllCallbackGetPtr($Timer))
EndIf
EndIf
EndSelect
EndIf
EndIf
Next
以前是在数据库读写数据 有最近想把数据读写到数组在操作想着速度应该能快很多 但是测试速度都差不多 请大神看看 这段代码能优化吗