Board index » delphi » Mailslot server is Win NT and client is Win 95

Mailslot server is Win NT and client is Win 95

I have a problem connecting a Win 95 client to a Win NT mailslot server.

The code I use to connect is :

  hToSlot := CreateFile(PChar('\\*\mailslot\ServerTest'),
                                      GENERIC_WRITE,
                                      FILE_SHARE_READ,
                                      NIL,
                                      OPEN_EXISTING,
                                      FILE_ATTRIBUTE_NORMAL,
                                      0);
  If hToSlot = INVALID_HANDLE_VALUE Then
    Exit; // Error
  Try
    BytesWritten := 0;
    If (NOT WriteFile(hToSlot,
                      Pointer(Mail)^,
                      Length(Mail),
                      BytesWritten,
                      NIL))         OR
        (BytesWritten <> Length(Mail)) Then
      Exit; // Error
    Result := True;  // Everthing went good
  Finally
    CloseHandle(hToSlot);
  end;

The server mailslot is created as follows :

    FHandle := CreateMailSlot(PChar('\\.\mailslot\ServerTest'),
                            MaxSize,
                            MAILSLOT_WAIT_FOREVER,
                            NIL);

The reading at the server side is (Result = string) :

  SetLength(Result,FNextSize);
  ReadFile(Handle,PChar(Result)^,FNextSize,ReadSize,NIL);

Is this a known problem or am I doing something wrong.

I am using Delphi3.

Thanks,

Yves

 

Re:Mailslot server is Win NT and client is Win 95


Yves:

The client side needs to include the _machine_ name of the listening
mailslot server, e.g. : \\PC_1234\MAILSLOT\SERVERTEST  , to send a message.
Otherwise, the network transport layer simply has no clue _where_ to send
the message to.
Also be aware that mailslot messages are sent for _each_ transport stack
present on the sending machine ( TCP/IP, NETBEUI, IPX,...), and hence may
(will)  be received multiple times on the server side. IOW : you need to
devise a message numbering  system...

Hope this helps,

Regards,
Dirk Claessens
______________________________________________
dirk.claess...@village.ZZuunet.be
dirk.claessens...@belgium.ZZagfa.com
Mailheader was forged  to fight spam !
Use the above and remove ZZ
______________________________________________

Re:Mailslot server is Win NT and client is Win 95


Dirk,

I have tried to specify the computer name directly but it still doesn't
work.
I use the '*' to give the server the change to identify himself to the
client.

Perhaps it is better to use named pipes ?

Regards,

Yves.

Quote
Dirk Claessens wrote in message <71ak7d$ef...@xenon.inbe.net>...
>Yves:

>The client side needs to include the _machine_ name of the listening
>mailslot server, e.g. : \\PC_1234\MAILSLOT\SERVERTEST  , to send a message.
>Otherwise, the network transport layer simply has no clue _where_ to send
>the message to.
>Also be aware that mailslot messages are sent for _each_ transport stack
>present on the sending machine ( TCP/IP, NETBEUI, IPX,...), and hence may
>(will)  be received multiple times on the server side. IOW : you need to
>devise a message numbering  system...

>Hope this helps,

>Regards,
>Dirk Claessens
>______________________________________________
>dirk.claess...@village.ZZuunet.be
>dirk.claessens...@belgium.ZZagfa.com
>Mailheader was forged  to fight spam !
>Use the above and remove ZZ
>______________________________________________

Other Threads