WriteBinary - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.
Our website is currently undergoing maintenance, which may result in occasional errors while browsing. We apologize for any inconvenience this may cause and are working swiftly to restore full functionality. Thank you for your patience.

Online Help

All Products    Maple    MapleSim


Sockets

  

WriteBinary

  

write binary data on a socket connection

 

Calling Sequence

Parameters

Description

Examples

Calling Sequence

WriteBinary(sid, a)

Parameters

sid

-

socket ID for the socket connection

a

-

rtable with hardware datatype

Description

• 

The procedure Sockets[Write] cannot be used to write binary data on a socket connection because Maple strings cannot encode the data. Therefore, the interface WriteBinary is provided to enable you to send binary data onto a socket connection.

• 

The first argument is a valid and open socket ID sid on which the data is written. The second argument is an rtable a with a hardware datatype that contains the data you want to write to the socket connection.

• 

The rtable a cannot use indexing functions and it must have rectangular storage. The rtable can have any of the following hardware datatypes:

integer[ 1 ]

integer[ 2 ]

integer[ 4 ]

integer[ 8 ]

float[ 4 ]

float[ 8 ]

 

 

• 

If the datatype of a is anything but integer[1], then the data is treated as structured and each "record" is converted to Network Byte Order before being written to the socket.

• 

The number of bytes actually written to the socket is returned as a Maple (non-negative) integer.

Examples

withSockets:

sidOpenmantis,echo

0

(1)

aArrayconvertHello,bytes,datatype=integer1

a72101108108111

(2)

WriteBinarysid,a

5

(3)

Readsid

Hello

(4)

Closesid

true

(5)

See Also

rtable

socket definition

Sockets

Sockets[ReadBinary]

Sockets[Write]