Documentation

echoudp

Start or stop UDP echo server

Syntax

echoudp('state', port)
echoudp('state')

Arguments

'state'

Turn the server on or off.

port

Port number of the server.

Description

echoudp('state', port) starts a UDP server with port number specified by port. state can only be on.

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

Examples

Start the echo server and create a UDP object.

echoudp('on',4012)
u = udp('127.0.0.1',4012);

Connect the UDP object to the host.

fopen(u)

Write to the host and read from the host.

fwrite(u,65:74)
A = fread(u,10);

Stop the echo server and disconnect the UDP object from the host.

echoudp('off')
fclose(u)

See Also

| |

Was this topic helpful?