socket.write

Syntax

v = socket.write(a,i1,s)

Write FISH variables through a socket. The FISH variables are stored in the specified FISH array. Currently, only parameters of type Boolean, Integer, Real, String, or Vector can be sent or received via sockets.

Note

For connections to sockets created in a language other than FISH, parameters are encoded as described below. First a 32 bit integer is sent indicating the parameter type. The size and encoding that comes next is dependent on the parameter, as described in the table below. All values are little-endien.

Table 1: Socket Parameter Encoding

Code

Type

Encoding

1

Integer

32 bit (4 byte) signed integer.

2

Real

64 bit (8 byte) double precision floating point value.

3

String

32 bit integer indicating how many bytes are following. This will always be in increments of 4. The string data is not necessarily null terminated.

5

2D Vector

Two 64 bit (8 byte) double precision floating point values.

6

3D Vector

Three 64 bit (8 byte) double precision floating point values.

7

Integer

64 bit (8 byte) signed integer.

8

Boolean

8 bit signed integer. Zero means false. Non-zero means true.

Returns:

v - void return

Arguments:

a - array pointer

i1 - number of FISH variables to send

s - socket pointer or integer specifying the channel number with value from 0 to 5