can someone tell me why this code feezes!

BlitzPlus Forums/BlitzPlus Programming/can someone tell me why this code feezes!

This is my first code that deals with tcp/ip and sockets, and it keeps on freezing after i initialize 100 variables using an array. I dont know if it is because the array and the server is putting too much pressure on the processor, or if it is becuase B+ is an extremely inneficient language , but if i cant get the server right, Ill never be able to finish my program!!!
heres the code


Graphics 320,240,32,2
SetBuffer BackBuffer()
ClsColor 0,0,0
Cls
x = 0
mainserver =CreateTCPServer(1234)
If mainserver <> 0 Then
Text  0,0,"Server started succesfully"
Text 0,15, "Core program will commence"
Goto start
Else
Text 0,0,"Error Occured - Server cant start"
Text 0,10, "Program will shut down in 5"
Delay 5000
End
EndIf
.start
;;;wait for the data;;;
Dim connectiondata$(100)
For i= 0 To 100
connectiondata$(i) = "no connection"

Next

Text 0,30,"Arrays initialized"

While Not KeyDown(1)

.start2
Text 0,60,"Entering main loop, refernce point made"

stream$ = AcceptTCPStream(mainserver)

Text 0,45, "Accepting a TCP stream"

If stream$

x = 1 ;;;;x is the number of connection

connectiondata$(x) = ReadString(stream$)

Text 0,30, "got one"

Else

Goto start2

EndIf

Wend



ive figured out (by entering print comands to show me that the code is ok up to there) that the problem liees within
stream$=AcceptTCPStream(mainserver)

maybe it can also be when initialized the server, i dont know. i need help!

Try this without the goto madness. :)
Graphics 320,240,32,2
SetBuffer BackBuffer()
ClsColor 0,0,0
Cls
x = 0
mainserver =CreateTCPServer(1234)
If mainserver <> 0 
	Text  0,0,"Server started succesfully"
	Text 0,15, "Core program will commence"
Else
	Text 0,0,"Error Occured - Server cant start"
	Text 0,10, "Program will shut down in 5"
	Delay 5000
	End
EndIf

;;;wait for the data;;;
Dim connectiondata$(100)
For i= 0 To 100
connectiondata$(i) = "no connection"

Next

Text 0,30,"Arrays initialized"

While Not KeyDown(1)

.start2
Text 0,60,"Entering main loop, refernce point made"

stream$ = AcceptTCPStream(mainserver)

Text 0,45, "Accepting a TCP stream"

If stream$

x = 1 ;;;;x is the number of connection

connectiondata$(x) = ReadString(stream$)

Text 0,30, "got one"

EndIf

Wend


One more thing, change the Stream$ to a int.

thanks