The example for TCPSocket has the above code which errors
What am I missing about Print and EditField and why does
the example below error at the "Print" statememt
Thanks
This example uses a TCPSocket to establish an internet connection.
Dim start, stop as Integer
Dim TCPSocket1 as TCPSocket
//create a TCPSocket
TCPSocket1 = New TCPSocket
//set its port and address
//EditField1 contains a valid url, such as "www.realsoftware.com"
TCPSocket1.Address = EditField1.Text
TCPSocket1.Port = 80
//Print is a method that writes a new row of text into a multiline
EditField
Print "Beginning syncrhonous connection..."
//connect the socket
TCPSocket1.Connect
start = Ticks
//while the socket isn't connected
While Not TCPSocket1.IsConnected
//check to see if the socket got an error
If TCPSocket1.LastErrorCode <> 0 then
Print "Socket Error: " + str(TCPSocket1.LastErrorCode)
Exit
End If
//poll the socket to let it do its thing
TCPSocket1.Poll
Wend
stop = Ticks
//if we broke the loop because we're connected
If TCPSocket1.IsConnected then
Print "Socket Connected in " + Str(stop - start) + " ticks"
//here would be a great place to do a synchronous read operation...
Else
//The socket broke out of the loop due to an error
Print "Socket failed to connect. It took " + Str(stop - start) + _
" ticks to figure that out"
End If
//close the socket
TCPSocket1.Close
Print "Socket closed"
The comment is trying (not very clearly) to explain that the example
code relies on the assumption that you have created a method "Print"
that writes the row of text.
It could be something as simple as:
Sub Print(strng As String)
If EditField1.Text <> "" Then
EditField1.AppendText EndOfLine
End If
EditField1.AppendText strng
End Sub