Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
where can I get more info about TCP/IP in QB64?
#1
Hello QB64 friends

I was playing with Steve's code about multiscreen using TCP/IP ... but I have no informations about this field of programming, so I am also in learning mode...
where I can get more informations about the use of TCP/IP used in localhost mode?
I have read WIKI and its code examples ....
but how many clients can I connect to a localhost?
I have found no answer to this my dubt.

Thanks for helping.
Reply
#2
I've stored several hundreds at one time to a local host.  If there's a limit to the number, it's greater than whatever my needs have always been.  Smile
Reply
#3
I've got a trouble with this wiki example code about sharing data with TCP/IP...
on my Lenovo Ideapad 3  I got nothing new after the FOR loop!
I have used QB64pe 3.8.0

wiki example about sharing data by TCP/IP

does it work  in your Pc/notebook?

@Steve
where can I get more informations about the use of TCP/IP used in localhost mode?
Reply
#4
@TempodiBasic 
try it this way and see if it works
create the executable and make a duplicate
click on one copy to highlight/select it
control-click on the second copy and then press return, both copies should run at about the same time
the first time you run it Windows may ask you if you want to allow the app to communicate, allow it, you may need to close the apps and try again
Reply
#5
Hi Jack 
you're right! I got this

[Image: Sharing-data-by-TCP-IP.jpg]

with this code
Code: (Select All)

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 running two copies of me at once!)"
    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"
    Do
        z = _OpenConnection(x)
        If z <> 0 Then
            Put #z, , a() 'send array a to any client that connects
            Close z
            Print "Array data send to client!"
        Else
            Print "Failure connection"
        End If
        _Limit 10
    Loop Until InKey$ <> ""
    Print "Finished!"
    End
End If

'connect to host as a client
Print "Conected to host. Reading data..."
Do
    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
PS the debug message is mine, not of origiinal code.
Reply




Users browsing this thread: 2 Guest(s)