Anoop
2007-01-21 15:43:23 UTC
Hi Experts,
Sorry to spam if this topic was already discussed.
I am writing an application using mail slots for a distributed
environment where nodes in the network introduce each other by writing
to a pre-defined mail slot.
Following is a simplistic scenario which is failing for me:
I created a mail slot reader using CreateMailslot(), with name
\\.\mailslot\mymailslot, with sec attributes NULL.
I then created a mail slot writer, through
CreateFile("\\\\*\\mailslot\\mymailslot",
GENERIC_WRITE,
FILE_SHARE_READ,
NULL /*sec*/ , OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL,
NULL /*template*/);
The reader indefinitely waits on a ReadFile() over the handle returned
by CreateMailSlot() above.
When I run this program locally, everything works fine. The writer
writes something and reader is able to receive whatever was written.
But when I run this program on different machines, say the reader on
machine1 and writer on machine2, then they dont work. Both the machines
are on the same domain and I have used the same domain credentials to
login to both the systems. The writer writes something, but the reader
is not able to receive it. It continues its wait for reading!
Again, if I change the wildcards on the writer (CreateFile()) and put
machine1 there, like \\machine1\mailslot\mymailslot, then the writer on
machine2 can write to the reader on machine1. Everything works again!
So why is wild card naming not working for me? I am thus not able to
broadcast any messages! Any clue into this problem will be very helpful
as I am rather blocked by it!
Thanks
Anoop
Sorry to spam if this topic was already discussed.
I am writing an application using mail slots for a distributed
environment where nodes in the network introduce each other by writing
to a pre-defined mail slot.
Following is a simplistic scenario which is failing for me:
I created a mail slot reader using CreateMailslot(), with name
\\.\mailslot\mymailslot, with sec attributes NULL.
I then created a mail slot writer, through
CreateFile("\\\\*\\mailslot\\mymailslot",
GENERIC_WRITE,
FILE_SHARE_READ,
NULL /*sec*/ , OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL,
NULL /*template*/);
The reader indefinitely waits on a ReadFile() over the handle returned
by CreateMailSlot() above.
When I run this program locally, everything works fine. The writer
writes something and reader is able to receive whatever was written.
But when I run this program on different machines, say the reader on
machine1 and writer on machine2, then they dont work. Both the machines
are on the same domain and I have used the same domain credentials to
login to both the systems. The writer writes something, but the reader
is not able to receive it. It continues its wait for reading!
Again, if I change the wildcards on the writer (CreateFile()) and put
machine1 there, like \\machine1\mailslot\mymailslot, then the writer on
machine2 can write to the reader on machine1. Everything works again!
So why is wild card naming not working for me? I am thus not able to
broadcast any messages! Any clue into this problem will be very helpful
as I am rather blocked by it!
Thanks
Anoop