Write - Maple Help

Sockets

 Write
 write textual data to a socket connection

 Calling Sequence Write(sid, text)

Parameters

 sid - valid open socket ID text - string; textual data to write to the socket

Description

 • The procedure Write is used to write textual data, in the form of Maple strings, to a socket connection.
 • The argument sid is a valid socket ID for an open socket connection. The argument text is the data (in the form of a Maple string) that is written to the socket connection.
 • Write attempts to write all the data in the text argument to the socket indicated by sid. If the write operation is successful, the value true is returned. Otherwise, Write returns the value false.
 Note: The text data cannot contain null bytes. You can write binary data to a socket connection by using the procedure Sockets[WriteBinary].

Examples

 > $\mathrm{with}\left(\mathrm{Sockets}\right):$
 > $\mathrm{sid}≔\mathrm{Open}\left("localhost","echo"\right)$
 ${0}$ (1)
 > $\mathrm{Write}\left(\mathrm{sid},"Some data to send to the echo server"\right)$
 ${36}$ (2)
 > $\mathrm{Read}\left(\mathrm{sid}\right)$
 ${"Some data to send to the echo server"}$ (3)
 > $\mathrm{Close}\left(\mathrm{sid}\right)$
 ${\mathrm{true}}$ (4)