Search code examples
cwinapiclient-servermailslot

Can't send wchar_t array through mailslot


I can't send chunks of data bigger than 420 bytes. For example if i try to send 421 bytes, i can't read it with ReadFile. If I check the maislot info with GetMailslotInfo( handleRead, 0, &msgSize, 0, 0 ); then msgSize will always be -1.

So this will never work for me:

err = WriteFile( handleWrite, wcharArrayToSend, 421, &numBytesWritten, NULL );

Does anyone know a reason for this behavior? Is this a normal behavior?


Solution

  • Per MSDN's documentation on mailslots:

    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.