Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

echotcpip

Start or stop TCP/IP echo server

Syntax

echotcpip('state',port)
echotcpip('state')

Arguments

'state'

Turn the server on or off.

port

Port number of the server.

Description

echotcpip('state',port) starts a TCP/IP server with port number specified by port. state can only be on.

echotcpip('state') stops the echo server. state can only be off.

Examples

collapse all

This example shows how to set up an echo server. Start the echo server on port 4000 and create a TCPIP object. Connect the TCPIP object to the host.

echotcpip('on',4000)
t = tcpip('localhost',4000);
fopen(t)

Communicate with the echo server. Write to the host and read from the host, then display the read data.

fprintf(t,'echo this string.')
data = fscanf(t);
data
data =

  1×18 char array

echo this string.


Dismiss the echo server. Stop the echo server and disconnect the TCPIP object from the host.

echotcpip('off')
fclose(t)

See Also

| |

Introduced before R2006a

Was this topic helpful?