|
========================================================================
CONSOLE APPLICATION : CppMailslotServer Project Overview
========================================================================
/////////////////////////////////////////////////////////////////////////////
Use:
Mailslot is a mechanism for one-way inter-process communication in the local
machine or across the computers in the intranet. Any clients can store
messages in a mailslot. The creator of the slot, i.e. the server, retrieves
the messages that are stored there:
Client (GENERIC_WRITE) ---> Server (GENERIC_READ)
This sample demonstrates a mailslot server, \\.\mailslot\HelloWorld. It first
creates such a mailslot, then it reads the new messages in the slot every
five seconds.
/////////////////////////////////////////////////////////////////////////////
Project Relation:
CppMailslotClient -> CppMailslotServer
CppMailslotClient is the client end of the mailslot.
/////////////////////////////////////////////////////////////////////////////
Code Logic:
1. Create a mailslot. (CreateMailslot)
2. Check messages in the mailslot. (ReadMailslot)
2.1. Check for the number of messages in the mailslot. (GetMailslotInfo)
2.2. Retrieve the messages one by one from the mailslot. While reading,
update the number of messages that are left in the mailslot.
(ReadFile, GetMailslotInfo)
3. Close the handle of the mailslot instance. (CloseHandle)
/////////////////////////////////////////////////////////////////////////////
References:
Using Mailslots / Reading from a Mailslot
http://msdn.microsoft.com/en-us/library/aa365785.aspx
IPCWorkshop By Venkat Raman
http://www.codeproject.com/KB/threads/ipcworkshop.aspx
/////////////////////////////////////////////////////////////////////////////
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Microsoft All-In-One Code Framework delineates the framework and skeleton of Microsoft development techniques through typical sample codes in three popular programming languages (Visual C#, VB.NET, Visual C++). Each sample is elaborately selected, composed, and documented to demonstrate one frequently-asked, tested or used coding scenario based on our support experience in MSDN newsgroups and forums. If you are a software developer, you can fill the skeleton with blood, muscle and soul. If you are a software tester or a support engineer like us, you may extend the sample codes a little to fit your specific test scenario or refer your customer to this project if the customer's question coincides with what we collected.
http://cfx.codeplex.com/