09-20-2024, 10:16 PM
Hi friends,
please help me to find where I have coded the bug...
I get always the message of error "invalid Handle" on line ... (that of _OPENCONNECTION instruction) but I am not able to understand why.
Thanks for time spent for helping me
please help me to find where I have coded the bug...
Code: (Select All)
$Unstable:Http
Screen _NewImage(512, 512, 256)
Dim a(511, 511) As Integer 'an array we'll send
x = _OpenClient("TCP/IP:1234:localhost") 'try to connect to a host
If x = 0 Then 'couldn't be client, so become a host
'put some data into array a
For xx = 0 To 511
For yy = 0 To 511
a(xx, yy) = xx * yy
Next
Next
Print "(Try passing data via TCP/IP!)"
Print "Waiting... (Press any key to end)"
x = _OpenHost("TCP/IP:1234")
If x = 0 Then Print "failure to create host" Else Print "Host ON"
End If
x = _OpenClient("TCP/IP:1234") 'try to connect to a host
Print x
If x < 0 Then
z = _OpenConnection(x)
Print "z"; z
'connect to host as a client
If z < 0 Then
Print "Connected to host. Reading data..."
Do
Put #z, , a() 'send array a to any client that connects
Close z
Print "Array data send to client!"
Get #x, , a()
_Limit 100
Loop Until EOF(x) = 0 'wait until enough data to fill the array arrives
For xx = 0 To 511
For yy = 0 To 511
PSet (xx, yy), a(xx, yy)
Next
Next
Close x
Print "That's how you share data folks!" 'G@lleon
Do: Loop Until InKey$ = ""
Else
Print "Failure connection with z "; z
End If
_Limit 10
Print "Finished!"
End
Else
Print "Failure to create host client connection "; x
End If
End
I get always the message of error "invalid Handle" on line ... (that of _OPENCONNECTION instruction) but I am not able to understand why.
Thanks for time spent for helping me