Muokkaa

Jaa


Mailslot Operations

When working with mailslots, clients and servers should use only the functions discussed in the following tables. Do not use other functions, even if they accept file handles or file names as parameters, as they are not designed to work with mailslots.

Mailslot Server Functions

Mailslot servers have exclusive use of three functions, as shown in the following table.

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 time-out for a mailslot.

 

The following functions are also used by mailslot servers.

Function Description
DuplicateHandle Duplicates the mailslot handle.
ReadFile, ReadFileEx 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.
GetHandleInformation Retrieves properties of the mailslot handle.
SetHandleInformation Sets properties of the mailslot handle.

 

Mailslot Client Functions

A client process uses the following functions when interacting 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, WriteFileEx Writes data to a mailslot.