Main Content


Read line of ASCII string data from UDP socket

Since R2020b



    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. If the function is unable to return any data within the period specified by the Timeout property of u, it returns data as a 0-by-0 double []. u must be a byte-type udpport object. This function waits until the terminator is read or a timeout occurs.


    collapse all

    Create a UDP socket object and define its terminator.

    u = udpport;

    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.

    Version History

    Introduced in R2020b