Link to home
Start Free TrialLog in
Avatar of carceri
carceri

asked on

Mailslots

I'm creating a server application that needs to broadcast a message to several clients. I figure that mailslots is the way to go, but how do I create them?

I can get a communication going between two mailslots, but it depends on the order I start the applications. If I start the server first, all the clients get the correct mailslot handle, but doesn't receive messages written to that mailslot. If I start the clients first they can't get the handle, since it's not created by the server.

If I use CreateMailSlot on both client and server machines and start the client first I can send messages from the server to the client.

I guess that what I'm asking is: Does anyone have some examples of how to create these mailslots. I think my problem is that I use wrong parameters in (such as FILE_FLAG_OVERLAPPED, etc) in WriteFile, CreateFile and CreateMailSlot...

Anybody?
ASKER CERTIFIED SOLUTION
Avatar of NickRepin
NickRepin

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of NickRepin
NickRepin

I made a wrong paste from MSDN to the last sentence, but I hope it's clear enough.

To find examples, just open MSDN library (if you have MS Visual C) and choose the Platform SDK->Windows base services->Interprocess communications->Mailslots->Using mailslots.

Or select Search tab and search for CreateMailslot().



Avatar of carceri

ASKER

Thanks, now it works just as I intended :)