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
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
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
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 |
---|---|---|
Yes |
Fully supported. |
|
Yes |
Fully supported. |
|
No |
Not supported. |
|
No |
Not supported. |
|
No |
Not supported. |
|
No |
Not supported. |
|
No |
Not supported. |
|
No |
Not supported. |
|
No |
Not supported. |
|
No |
Not supported. |
|
No |
Not supported. |
|
No |
Not supported. |
|
No |
Not supported. |
|
No |
Last fully supported in QUARC 2018. |
See Also
Copyright ©2024 Quanser Inc. This page was generated 2024-10-17. Submit feedback to Quanser about this page.