15.1.3 Server and Client Functions

Clients and servers should use only the functions discussed in this section to work with mailslots. Other Windows functions should not be used, even if they accept file handles or filenames as arguments.

15.1.3.1 Server Functions

Mailslot servers have exclusive use of three functions:

Function Description

CreateMailslot Creates a mailslot and returns a mailslot handle.
GetMailslotInfo Retrieves the maximum message size, the mailslot size, the size of the next message in the mailslot, the number of messages in the mailslot, and the amount of time a read operation can wait for a message.
SetMailslotInfo Changes the read timeout for a mailslot.

The following functions are also useful to mailslot servers:

Function Description

ReadFile Retrieves messages from a mailslot.
GetFileTime Retrieves the date and time a mailslot was created.
SetFileTime Sets the date and time a mailslot was created.

15.1.3.2 Client Functions

A client process uses the following functions to interact with a mailslot:

Function Description

CloseHandle Closes a mailslot handle for a client process.
CreateFile Creates a mailslot handle for a client process.
DuplicateHandle Duplicates a mailslot handle.
WriteFile Writes data to a mailslot.