Code: Select all
#Include Once "snc.bi"
#Include Once "fbgfx.bi"
Using FB
ScreenRes 800,600,16
Dim shared result As Integer
Dim Shared As String tosend
tosend = "test"
var Client = NetworkClient("127.0.0.1",5469)
var ServerConnection = Client.GetConnection()
Do While Not MultiKey(SC_ESCAPE)
Sleep 2000,1
result = ServerConnection->PutData(StrPtr(tosend),5)
Print "Sent " & tosend
Print result
Print "______________"
loop
By changing the length from 5 to 4, it sends and receives data but the string has a weird character at the end. The SNC source says the second argument of put data is the length in bytes, but that it's LEN+1 for strings. But apparently that was why it was only completing when I closed it - it was waiting for an extra byte.
Very close. Thanks for all help so far!