Windows NT ( 2)

         

MSLOTS


MSLOTS 2.13.

2.13. mailslot/mslots/mslots.c

// ==================================================

// MSLOTS ( )

// Mailslot

//

//

// () .., 1996

// Email: frolov@glas.apc.org

// ==================================================

#include <windows.h>

#include <stdio.h>

#include <conio.h>

int main()

{

//

BOOL fReturnCode;

//

DWORD cbMessages;

// Mailslot

DWORD cbMsgNumber;

// Mailslot

HANDLE hMailslot;

// Mailslot

LPSTR lpszMailslotName = "\\\\.\\mailslot\\$Channel$";

//

char szBuf[512];

// ,

DWORD cbRead;

printf("Mailslotserver demo\n"

"(C) A. Frolov, 1996, Email: frolov@glas.apc.org\n");

// Mailslot, lpszMailslotName

hMailslot= CreateMailslot(

lpszMailslotName, 0,

MAILSLOT_WAIT_FOREVER, NULL);

// ,

//

if(hMailslot== INVALID_HANDLE_VALUE)

{

fprintf(stdout,"CreateMailslot: Error %ld\n",

GetLastError());

getch();

return 0;

}

//

fprintf(stdout,"Mailslotcreated\n");

//

while(1)

{

// Mailslot

fReturnCode = GetMailslotInfo(

hMailslot, NULL, &cbMessages,

&cbMsgNumber, NULL);

if(!fReturnCode)

{

fprintf(stdout,"GetMailslotInfo: Error %ld\n",