write binary data on a socket connection - Maple Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Connectivity : Web Features : Network Communication : Sockets Package : Sockets/WriteBinary

Sockets[WriteBinary] - write binary data on a socket connection

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:

sid:=Openmantis,echo

0

(1)

a:=ArrayconvertHello,'bytes','datatype'='integer'1

a:=72101108108111

(2)

WriteBinarysid,a

5

(3)

Readsid

Hello

(4)

Closesid

true

(5)

See Also

rtable, socket definition, Sockets, Sockets[ReadBinary], Sockets[Write]


Download Help Document

Was this information helpful?



Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam