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?
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks, now it works just as I intended :)
To find examples, just open MSDN library (if you have MS Visual C) and choose the Platform SDK->Windows base services->Interprocess communications->Mailslots-
Or select Search tab and search for CreateMailslot().