I2C Protocol Pipe Protocol navigation bar

Table of Contents > QUARC > User's Guide > QUARC Communications Protocols

Mailslot Protocol

The unidirectional mailslot communications protocol supports broadcasting small messages over a network domain or sending messages to a specific computer. It can also be used to synchronize with batch scripts via the WAITFOR command.

Syntax

mailslot:path?option=value,...            % Use a local mailslot identified by "path"
mailslot://computer/path?option=value,... % Use a mailslot identified by "path" on server "server"
mailslot://domain/path?option=value,...   % Broadcast to mailslots identified by "path" on domain "domain"
mailslot://-/path?option=value,...        % Broadcast to mailslots identified by "path" on primary domain
    

Description

The unidirectional mailslot communications protocol supports broadcasting small messages over a network domain or sending messages to a specific computer (including the host). It can also be used to synchronize with batch scripts via the WAITFOR command.

A mailslot is identified by using mailslot as the protocol name in the URI. It may be used to communicate between applications on the same computer or remote computers. It may also be used to communicate between models running on a Windows target and a Windows application or even a batch script.

The unusual feature of the mailslot protocol is that it is unidirectional. The server always receives messages and the client always sends messages. For bidirectional communication a second mailslot would be required going in the opposite direction.

The mailslot URI takes the form:

mailslot:path

where path is the name of the mailslot. The name may include pseudo-directories separated by slashes and thus resembles a file system path. This form accesses a mailslot on the local machine.

To access a mailslot on another computer, use a URI of the form:

mailslot://computer/path

where path is the name of the mailslot and computer is the name of the machine running the server-side of the mailslot. Note that the computer name should be the name that appears in the network browser. While the mailslot protocol is a datagram protocol, IP addresses are not supported.

To broadcast to mailslot servers running on multiple computers on a domain, use a URI of the form:

mailslot://domain/path

where domain is the domain name. To use the primary domain of the host simply use a hyphen, '-', in place of the domain name.

To interact with the WAITFOR command in a batch script, the path component of the mailslot URI should take the form:

WAITFOR.EXE/signal

where "signal" is the signal name specified in the WAITFOR command. For example, to have a batch script wait for a signal from a mailslot called "mysignal", use a WAITFOR command of:

waitfor mysignal

and a URI of:

mailslot:WAITFOR.EXE/mysignal.

If the batch script is running on another machine called "remote" then use a URI of the form mailslot://remote/WAITFOR.EXE/mysignal instead.

The WAITFOR command appears to expect the first seven bytes of the computer name in Unicode. For example, if the computer name is DAN-I7 then WAITFOR sends the bytes 68,0,65,0,78,0,45. However, it responds to even a single byte. Sending more than 7 bytes to WAITFOR is not recommended.

To send a signal from a batch script, use the command:

waitfor /si mysignal.

For further options to WAITFOR, such as timeouts and remote systems, type:

waitfor /?

at a Command Prompt.

The port in the URI is not used and should be omitted.

For listening streams, the mailslot path should not be used by other components in the system. In particular, two applications cannot listen on the same mailslot path if they will be running at the same time on the same target.

Limitations

Unidirectional communications

Warning Streams created by accepting a connection on a listening stream may only receive messages. Streams connecting as a client may only send messages.

QUARC Target Manager

Warning The mailslot protocol cannot be used for communicating with the target (via a target URI) because the mailslot protocol does not allow multiple connections on the same mailslot. Hence, qc_set_default_model_uri cannot be used to set a default mailslot protocol for models. Instead, the model URI must be specified explicitly in the Code Generation/Interface/MEX file arguments option of the Configuration Parameters of the model as well as the target URI.

Multiple client connections

Warning The mailslot protocol will only accept a single client connection at a time on a given mailslot. It does not support time-division multiplexing of multiple client connections over a single mailslot because doing so would require adding a header to the information packets sent over the connection. QUARC communication protocols never add extra information to the data sent over the communication channel in order to allow QUARC to communicate with user applications, sensors and other devices which would not support QUARC-specific data packets.

Options

timeout

Set this option to the timeout interval to use for blocking reads. The default timeout interval is infinite.

sndsize

Set this option to set the maximum message size for the mailslot. The default size is unlimited for messages sent to the same machine, or 424 bytes if the message is sent to remote machine(s).

sddl

A security descriptor string used to change the security permissions on the mailslot.

Driver

The driver supporting mailslot communications is called qrt_mailslot.

Targets

Target

Supported

Comments

QUARC Win32 Target

Yes

Fully supported.

QUARC Win64 Target

Yes

Fully supported.

QUARC Linux Nvidia Target

No

Not supported.

QUARC Linux QBot Platform Target

No

Not supported.

QUARC Linux QCar 2 Target

No

Not supported.

QUARC Linux QDrone 2 Target

No

Not supported.

QUARC Linux Raspberry Pi 3 Target

No

Not supported.

QUARC Linux Raspberry Pi 4 Target

No

Not supported.

QUARC Linux RT ARMv7 Target

No

Not supported.

QUARC Linux x64 Target

No

Not supported.

QUARC Linux DuoVero Target

No

Not supported.

QUARC Linux DuoVero 2016 Target

No

Not supported.

QUARC Linux Verdex Target

No

Not supported.

QUARC QNX x86 Target

No

Last fully supported in QUARC 2018.

See Also

 

navigation bar