A client script must know, and use, this same name in order to write records to that particular mailslot.
When a server script creates a mailslot, the mailslot name must have the following form:
\\.\mailslot\[path]nameA mailslot name starts with the following, required parts: two backslashes to begin the name, a period, a backslash following the period, the word mailslot, and a trailing backslash. After that is an optional "path" to the mailslot (and note that the brackets simply indicate that it's optional -- they are not actually supposed to be there), and then the name of the mailslot. Names are not case-sensitive, so "BLORT" is the same as "blort".
A mailslot name can be preceded by a path consisting of the names of one or more directories, separated by backslashes. For example, if a server script expects records on the subject of taxes from Bob, Pete, and Sue, then the script may create 3 mailslots (ie, one for each person) with the following names:
\\.\mailslot\taxes\bob \\.\mailslot\taxes\pete \\.\mailslot\taxes\sueAbove the author of the server script will create a mailslot named "bob" (in the "taxes" folder, although remember that this folder exists only in memory -- not on disk), a mailslot named "pete" (in the taxes folder), and a mailslot named "sue" (in the taxes folder).
To write a message to a mailslot, a client script "opens" that mailslot by its name. The client uses the following form:
\\ComputerName\mailslot\[path]nameThis is similiar to how the server specifies the name, except now, instead of the dot, the client specifies the name of the computer upon which the mailslot resides.
So if the client wants to send a record to the "sue" mailslot on the computer named "JoesComputer", it would use the name:
\\JoesComputer\mailslot\taxes\sueIf there are several computers that happen to have a mailslot named "sue" in the taxes folder, then the client can simultaneously write the same record to all of those mailslots (with a single call to one operating system function) by substituting the domain name in lieu of a particular computer's name. For example, assume that both JoesComputer and JohnsComputer both have that sue mailslot in taxes, and they are on a domain named "WorkGroup". The client script can send the same record to both by using the mailslot name:
\\WorkGroup\mailslot\taxes\sue
If the client wants to write the same record to every sue mailslot in a network's primary domain, then it can simply use an asterisk for the domain name as so:
\\*\mailslot\taxes\sue
Note: If the client and server scripts are both running on the same computer, then the client can use the same name that the server uses to create the mailslot. Above, that would be "\\.\mailslot\taxes\sue". This may be useful for testing purposes.