ReadLine - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


Sockets

  

ReadLine

  

read a line of text from a socket

 

Calling Sequence

Parameters

Description

Examples

Calling Sequence

ReadLine(sid, timeout)

Parameters

sid

-

valid open socket ID

timeout

-

(optional) non-negative integer; number of seconds to block before timing out

Description

• 

Many network protocols are line-based to allow for easy and efficient implementation. For this reason, a separate entry point ReadLine is provided for reading text one line at a time over a socket connection.

• 

The procedure ReadLine is similar to the procedure Sockets[Read], however, it stops reading upon encountering the first newline (ASCII 10) character in the data. Like Sockets[Read], the procedure ReadLine is used to read textual data from a socket. It cannot be used to read data containing null bytes. (To read binary data, see Sockets[ReadBinary].)

• 

The argument sid must be a valid socket ID for an open socket connection. The optional argument timeout indicates the number of seconds the call to ReadLine should block before timing out and returning the value false.

• 

The ReadLine procedure obeys the persistent timeout protocol. (See Sockets/timeout.)

Examples

withSockets:

sidOpenlocalhost,echo

0

(1)

Writesid,The higher, the fewer!\n

23

(2)

ReadLinesid

The higher, the fewer!

(3)

Closesid

true

(4)

sidOpenmantis,echo

0

(5)

Writesid,The higher,\nthe fewer!\n

23

(6)

ReadLinesid

The higher,

(7)

ReadLinesid

the fewer!

(8)

Closesid

true

(9)

See Also

socket definition

Sockets

Sockets/timeout

Sockets[Peek]

Sockets[Read]

Sockets[ReadBinary]