473,387 Members | 1,420 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Need MailSlot sample

Hi NG,

I am working on a project in VS2005 that has to comunicate with an older
application, using MailSlots.
As far as I know, I have to use pInvoke to achieve this.
It would be greate, to have a little sample on how to do this, please not
only the C# signature like:

[DllImport("kernel32.dll")]
static extern IntPtr CreateMailslot(string lpName, uint nMaxMessageSize,
uint lReadTimeout, IntPtr SecurityAttributes);

It would be greate to have a simple comlete sample that does a
create,write,read !

Regards
Rainer Queck
Dec 13 '05 #1
4 7129
Rainer,

Well, once you have the IntPtr which represents the mail slot, you can
pass that to the constructor of the FileStream class to read/write to the
mail slot. You don't need to be shown how to use that class, do you? =)

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Rainer Queck" <Ra****@noemail.noemail> wrote in message
news:uI*************@tk2msftngp13.phx.gbl...
Hi NG,

I am working on a project in VS2005 that has to comunicate with an older
application, using MailSlots.
As far as I know, I have to use pInvoke to achieve this.
It would be greate, to have a little sample on how to do this, please not
only the C# signature like:

[DllImport("kernel32.dll")]
static extern IntPtr CreateMailslot(string lpName, uint nMaxMessageSize,
uint lReadTimeout, IntPtr SecurityAttributes);

It would be greate to have a simple comlete sample that does a
create,write,read !

Regards
Rainer Queck

Dec 13 '05 #2
Hi Rainer,
Welcome to MSDN Newsgroup!

I browse some following articles (including samples) from internet. I think
they are you want and hope it's useful for you,
Title: Using a Mailslot to read/write data over a network
URL: http://www.codeproject.com/internet/mailslots.asp

Title: Using Mailslots for Interprocess Communication
URL: http://www.codeproject.com/cpp/mailslots.asp

If you have any questions or concerns, please let me know. I am standing by
to help you. Thanks again and have a nice day!

Best Regards,

Terry Fei[MSFT]
Microsoft Community Support
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Dec 14 '05 #3
Hi Terri,
I browse some following articles (including samples) from internet. I
think
they are you want and hope it's useful for you,

Thanks, yes they were useful.

Regards
Rainer
Dec 14 '05 #4
Hi Rainer,
I am glad to know it's helpful for you.
Thanks for participating the community!

Best Regards,

Terry Fei[MSFT]
Microsoft Community Support
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Dec 15 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Ted | last post by:
Is it possible to use mailslots in .NET using PInvoke? I have a VC++ 6.0 based app that creates and listens to a mailslot. I have a second VC++ 6.0 based app that opens the mailslot and writes...
5
by: franklini | last post by:
i cant seem to figure out what is wrong with this class. it has to do with the input/output stream override. please can somebody help me. #include <iostream> #include <string> #include <vector>...
0
by: aherzallah | last post by:
Hi every one I have a question, how can I create a MailSlot in .NET using C#, just like the windows API CreateMailslot (in case still not clear please see the link...
1
by: aherzallah | last post by:
Hi every one can anyone help me on how can I create/write/read from a MailSlot in .NET using C#, just like the windows API CreateMailslot, (in case still not clear please see the link...
1
by: vertigo | last post by:
Hello Can i use mailslot mechnism in C# ? I could find API for mailslot only for C/C++ for example: HANDLE CreateMailslot( LPCTSTR lpName, DWORD nMaxMessageSize, DWORD lReadTimeout,...
1
by: vertigo | last post by:
Hello I've tried to create mailslot server, and send there some packets. On both sides every operation is successful, but on server side message do not appear. Is there any client under...
0
by: vertigo | last post by:
Hello I receive some mailslot packets. Can i check from whom i have received them ? Thanx Michal
0
by: Hennie Coertze | last post by:
Good day, My knowledge of XML is next to none and I only have one XSL code to use. I also assume I may be using incorrect jargon and hope you will understand what I need. I have an XSL style...
1
by: write2ashokkumar | last post by:
hi... i have the table like this, Table Name : sample Total Records : 500000 (Consider like this) Sample Records: id ------------ name
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.