Sign in to follow this  
Followers 0
lainai

Array not being built?

1 post in this topic

#1 ·  Posted (edited)

So I've written a fairly lengthy TCP Client with the help of a friend. But I have an issue.

So I've declared an array.

This is an example script; since the real one is hardly reasonable to post and it jumps around way too much. lol.

Global $Necessary[1] = ["0"]

$Recv = TCPRecv($hSockeet, 1024, 1) ;Contains nullbytes sometimes.
$Recv = BinaryToString("0x" & $Recv, 4)
$sMethod = StringSplit($Recv, ".", 2)

Switch $sMethod[0]
Case 1
  $nSearch = _ArraySearch($Necessary, $sMethod[1] & "." & $sMethod[7])
  If $nSearch = -1 Then
    _ArrayAdd($Users, $sMethod[1] & "." & $sMethod[7])
    ConsoleWrite($sMethod[1] & "." & $sMethod[7] & @CRLF)
  EndIf
EndSwitch

There's of course plenty more but that's the only part where data is added to the $Necessary array. And thats the only array that breaks. If I try and perform an array display later, it doesn't even bring up as if the array was deleted. So any ideas?

Edit: I got sidetracked by ordering pizza. But the script DOES work sometimes. It's just a gamble, only 9 times out of 10 you lose and have to try again. And the data IS being received. I've even traced inside the loop and I can CLEARLY see it.

Edit 2: So after a many month long battle and lots of putting off. Having written out what my problem was, the solution became resoundingly obvious to me. I'll never know for sure what the issue was, but doing if IsArray then declaring the variable again fixed it. Thank you Autoit forums, you have in a weird way helped me.

Edited by lainai

Share this post


Link to post
Share on other sites



Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0