Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
TCP/IP invalid handle error. What can I do?
#4
Hi friends
thanks to Steve with his help I got solution of the issue...so it is SOLVED!

and this is the code working well
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


    x2 = _OpenClient("TCP/IP:1234:localhost") 'try to connect to a host
    Print x2
    If x2 < 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 #z, , a()
            _Limit 100
            '  Loop Until EOF(z) = 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 z
            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 If
End
Reply


Messages In This Thread
RE: TCP/IP invalid handle error. What can I do? - by TempodiBasic - 09-21-2024, 03:30 PM



Users browsing this thread: 1 Guest(s)