Main Content

readline

Read line of ASCII string data from UDP socket

    Description

    example

    data = readline(u) reads data from the specified UDP socket until the first occurrence of the terminator, and assigns the result to data as a string. u must be a byte-type udpport object. This function waits until the terminator is read or a timeout occurs.

    Examples

    collapse all

    Create a UDP socket object and define its terminator.

    u = udpport;
    configureTerminator(u,"CR/LF");

    Read an ASCII-terminated string from the udpport socket.

    data = readline(u);

    data does not include the terminator.

    Input Arguments

    collapse all

    UDP socket, specified as a byte-type udpport object.

    Example: u = udpport("byte")

    Data Types: udpport object

    Output Arguments

    collapse all

    String value read from the udpport socket, returned as a string.

    Introduced in R2020b