Documentation

This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the 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

Shows how to set up an echo server.

Start the echo server on port 4000 and create a TCPIP object.

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

Connect the TCPIP object to the host.

fopen(t)

Shows how to communicate with the echo server.

Write to the host and read from the host.

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

Display the read data.

data

The string is returned.

data =
echco this string.

Shows how to dismiss an 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?