🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #844

Re: MailSlots and messages longer than 424 bytes

#844
From: Bob Gonder
Date: Tue, 04 Dec 2007 17:06
58 lines
3200 bytes
AlexB wrote:

>It's part of JVCL's JvgMailSlot (slightly modified):

First, I have to wonder why you are asking Java/VCL/Delphi questions in a C++ group...

>procedure TJvgMailSlotServer.OnTimer(Sender: TObject);

Why is this on a timer?
There are much better ways such as threads and Read Events.

>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)

>      FData.Size:=MsgSize; // Allocate memory
>      Buffer:=FData.Memory;
>      // Reading message
>      if ReadFile(FHandle, Buffer^, MsgSize, Read, nil)

Similarly
      if ReadFile(FHandle, Buffer^, MsgSize, @Read, nil)

>    Result:=WriteFile(FHandle, MessageData, MessageLength, Written,nil);
    Result:=WriteFile(FHandle, MessageData, MessageLength, @Written,nil);

>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.
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.

>Server never see network messages longer then 1365 bytes
>(i.e. MsgSize=MAILSLOT_NO_MESSAGE).
>
>MSDN says that for long messages (up to 64K) mailslots require "SMB
>session". I have no idea how to check the presence of SMB session.

<quote>
The data in a mailslot message can be in any form, but cannot
be larger than 424 bytes when sent between computers. To send
messages that are larger than 424 bytes between computers,
use named pipes or Windows Sockets instead.</quote>
http://msdn2.microsoft.com/en-us/library/aa365130.aspx
Technical Details
Message-ID: <4oval3dmnmrvb512mcvf88lqcd0qs5tpc6@4ax.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news4.google.com!proxad.net!feeder1-2.proxad.net!62.111.101.3.MISMATCH!news.germany.com!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <4750140f@newsgroups.borland.com> <4752978b@newsgroups.borland.com> <475405ba@newsgroups.borland.com> <q2k9l3dlb97lddjgtvlksbj0sejqkij9sk@4ax.com> <4754ed37@newsgroups.borland.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: Bob Gonder <notbg@notmindspring.invalid>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: MailSlots and messages longer than 424 bytes
Date: Tue, 04 Dec 2007 09:06:56 -0800
Organization: MindSpring Enterprises, Inc.
Reply-To: notbg@notmindspring.invalid
Message-ID: <4oval3dmnmrvb512mcvf88lqcd0qs5tpc6@4ax.com>
References: <4750140f@newsgroups.borland.com> <4752978b@newsgroups.borland.com> <475405ba@newsgroups.borland.com> <q2k9l3dlb97lddjgtvlksbj0sejqkij9sk@4ax.com> <4754ed37@newsgroups.borland.com>
X-Newsreader: Forte Agent 1.93/32.576 English (American)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 69.69.83.80
X-Trace: newsgroups.borland.com 1196788014 69.69.83.80 (4 Dec 2007 09:06:54 -0700)
Lines: 60
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news4.google.com!proxad.net!feeder1-2.proxad.net!62.111.101.3.MISMATCH!news.germany.com!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail