Create a TCP/IP object called t
, connecting
to a TCP/IP echo server, with Port of 7
. This requires
you to have an echotcpip
server running on Port
7.
t =
tcpclient with properties:
Address: 'local host'
Port: 7
Timeout: 10
BytesAvailable: 0
The write
function synchronously writes data
to the remote host connected to the tcpclient
object.
First specify the data, then write the data. The function waits until
the specified number of values is written to the remote host.
Assign 10 bytes of uint8
data to the
variable data
.
data =
1 2 3 4 5 6 7 8 9 10
Check the data.
Name Size Bytes Class Attributes
data 1x10 10 uint8
Write data to the echo server.
Check that the data was written using the BytesAvailable
property.
Read the data from the server.
ans =
1 2 3 4 5 6 7 8 9 10
Close the connection between the TCP/IP client object
and the remote host by clearing the object.