Documentation Center

  • Trial Software
  • Product Updates

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

expand all

Start and Connect to an Echo Server

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)

Read and Write to the Echo Server

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.

Stop and Disconnect the Echo Server

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

| |

Was this topic helpful?