Instrument Control Toolbox | ![]() ![]() |
Syntax
Arguments
'rhost' |
The remote host. |
rport |
The remote port. |
' PropertyName ' |
A TCP/IP property name. |
PropertyValue |
A property value supported by PropertyName . |
obj |
The TCP/IP object. |
Description
obj = tcpip('rhost')
creates a TCP/IP object, obj
, associated with remote host, rhost
, and the default remote port value of 80.
obj = tcpip('rhost',rport)
creates a TCP/IP object with remote port value, rport
.
obj = tcpip(...,'
creates a TCP/IP object with the specified property name/property value pairs. If an invalid property name or property value is specified, the object is not created.PropertyName
',PropertyValue,...)
Remarks
At any time, you can use the instrhelp
function to view a complete listing of properties and functions associated with TCP/IP objects.
When you create a TCP/IP object, these property values are automatically configured:
Type
property is given by tcpip
.
Name
property is given by concatenating TCP/IP
with the remote host name specified in the tcpip
function.
RemoteHost
and RemotePort
properties are given by the values specified in the tcpip
function.
You can specify the property names and property values using any format supported by the set
function. For example, you can use property name/property value cell array pairs. Additionally, you can specify property names without regard to case, and you can make use of property name completion. For example, the following commands are all valid.
t = tcpip('144.212.113.252','InputBufferSize',1024) t = tcpip('144.212.113.252','inputbuffersize',1024) t = tcpip('144.212.113.252','Input',1024)
When the TCP/IP object is constructed, the Status
property value is closed
. Once the object is connected to the host with the fopen
function, the Status
property is configured to open
.
The default local host in multihome hosts is the system's default. The LocalPort
property defaults to a value of []
and it causes any free local port to be used. LocalPort
is updated when fopen
is issued.
Example
Start a TCP/IP echo server and create a TCP/IP object.
Connect the TCP/IP object to the host.
Write to the host and read from the host.
Disconnect the TCP/IP object from the host and stop the echo server.
Functions
fopen
, sendmail
, udp
, urlread
, urlwrite
Properties
LocalHost
, LocalPort
, LocalPortMode
, Name
, RemoteHost
, RemotePort
, Status
, Type
![]() | stopasync | trigger | ![]() |