tcpclient
Create a TCP Client.
Attention: Valid only with Altair Communication Extension.
Syntax
cobj = tcpclient(address,port)
cobj = tcpclient(address,port,[Name, value])
Inputs
- address
- server address tag
- port
- Numeric port number to connect to.
- Name, value
- Name
Outputs
- cobj
- TCPIP client object.
- property, values
- Type: string
- Function Name, Syntax
- Type: string
Examples
Connecting to server, read/write string data
sobj=tcpserver('127.0.0.1',9999);
cobj=tcpclient('127.0.0.1',9999);
sobj.Connected;
cobj.write('Hello Server');
sobj.read()
sobj.write('Hello Client');
cobj.read()
sobj.close();
cobj.close();
ans = Hello Server
ans = Hello Client
Connecting to server, read/write numeric data
sobj=tcpserver('127.0.0.1',9999);
cobj=tcpclient('127.0.0.1',9999);
sobj.Connected;
data=[1,2,3,4];
cobj.write(data,'double');
clientdata=sobj.read(4,'double')
data=99;
sobj.write(data,'int32');
serverdata=cobj.read(1,'int32')
sobj.close();
cobj.close();
clientdata = [Matrix] 1 x 4
1 2 3 4
serverdata = 99