Article View: borland.public.cppbuilder.nativeapi
Article #845Re: MailSlots and messages longer than 424 bytes
From: AlexB
Date: Wed, 05 Dec 2007 07:17
Date: Wed, 05 Dec 2007 07:17
62 lines
2988 bytes
2988 bytes
Bob Gonder wrote:
> I have to wonder why you are asking Java/VCL/Delphi questions
> in a C++ group...
As you can see initially it was question about API problem (language
independent).
> > procedure TJvgMailSlotServer.OnTimer(Sender: TObject);
>
> Why is this on a timer?
> There are much better ways such as threads and Read Events.
Yes, but timer is enough for beginning.
> > var
> > MsgSize: DWORD;
> > MsgNumber: DWORD;
> > Read: DWORD;
> > Buffer: Pointer;
> > begin
> > // Determining if there's message
> > if not GetMailSlotInfo(FHandle, nil, MsgSize, @MsgNumber, nil)
>
> I don't know Delphi, but that looks quite wrong. I would expect
> GetMailSlotInfo(FHandle, nil, @MsgSize, @MsgNumber, nil)
No, code is correct. In windows.pas:
function GetMailslotInfo
(hMailslot: THandle; lpMaxMessageSize: Pointer;
var lpNextSize: DWORD; lpMessageCount, lpReadTimeout: Pointer):
BOOL; stdcall;
lpNextSize (MsgSize in code) is 'var' (i.e. reference, not pointer).
> > Send works normally (always returns true).
> > Local messaging ('.\') with length up to 64K work without problems.
> > Network messaging (i.e. where name of computer was specified):
> > - up to 425 bytes in any case
> > - up to 1365 bytes after installation of NetBEUI.
>
> In other words, One Packet.
Yes.
> You need to prefix your message with a message size,
> and have the server keep reading until it gets all of the message.
> Then have the sender break up the message into packet size.
No any packet at all if L>425 (or 1365). Manual chUnk by chUnk sending
is not so good (delivery is not guaranteed).
> The data in a mailslot message can be in any form, but cannot
> be larger than 424 bytes when sent between computers.
> http://msdn2.microsoft.com/en-us/library/aa365130.aspx
Thank you for this information. Here I see this explicit limitation for
the first time; there is no such limitation in my local (outdated) MSDN.
--
Alex
Technical Details
Message-ID:
<47565eaa$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!proxad.net!feeder1-2.proxad.net!213.200.89.82.MISMATCH!tiscali!newsfeed1.ip.tiscali.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<4750140f@newsgroups.borland.com> <4752978b@newsgroups.borland.com> <475405ba@newsgroups.borland.com> <q2k9l3dlb97lddjgtvlksbj0sejqkij9sk@4ax.com> <4754ed37@newsgroups.borland.com> <4oval3dmnmrvb512mcvf88lqcd0qs5tpc6@4ax.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,5f39732d3fb3000f X-Google-Attributes: gid10cc67,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit From: "AlexB" <b.a.v@inbox.ru> Subject: Re: MailSlots and messages longer than 424 bytes Newsgroups: borland.public.cppbuilder.nativeapi References: <4750140f@newsgroups.borland.com> <4752978b@newsgroups.borland.com> <475405ba@newsgroups.borland.com> <q2k9l3dlb97lddjgtvlksbj0sejqkij9sk@4ax.com> <4754ed37@newsgroups.borland.com> <4oval3dmnmrvb512mcvf88lqcd0qs5tpc6@4ax.com> User-Agent: XanaNews/1.18.1.6 NNTP-Posting-Host: 212.192.185.54 Message-ID: <47565eaa$1@newsgroups.borland.com> Date: 5 Dec 2007 00:17:46 -0700 X-Trace: newsgroups.borland.com 1196842666 212.192.185.54 (5 Dec 2007 00:17:46 -0700) Lines: 62 Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!proxad.net!feeder1-2.proxad.net!213.200.89.82.MISMATCH!tiscali!newsfeed1.ip.tiscali.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail