- 01
 - 02
 - 03
 - 04
 - 05
 - 06
 - 07
 - 08
 - 09
 - 10
 - 11
 - 12
 - 13
 - 14
 - 15
 - 16
 - 17
 - 18
 - 19
 - 20
 - 21
 - 22
 - 23
 - 24
 - 25
 - 26
 - 27
 - 28
 - 29
 - 30
 - 31
 - 32
 - 33
 - 34
 - 35
 - 36
 - 37
 - 38
 - 39
 - 40
 - 41
 - 42
 - 43
 - 44
 - 45
 - 46
 - 47
 - 48
 - 49
 - 50
 - 51
 - 52
 - 53
 - 54
 - 55
 - 56
 - 57
 - 58
 - 59
 - 60
 - 61
 - 62
 - 63
 - 64
 - 65
 - 66
 
                        ...
// Импорт функций для работы с MailSlot
[DllImport("kernel32.dll")]
static extern int CreateMailslot(
	string name,
	int maxMessageSize,
	int readTimeout,
	int securityAttributes);
[DllImport("kernel32.dll")]
static extern int GetMailslotInfo(
	int hFile,			// mailslot handle
	int maxMsgSize,		// maximum message size
	int* lpcbMessage,	// size of next message
	int* lpcMessage,	// number of messages
	int timeout);		// read time-out
[DllImport("kernel32.dll")]
static extern int ReadFile(
	int hFile,
	void* lpBuffer,
	int nNumberOfBytesToRead,
	int* lpNumberOfBytesRead,
	int overlapped);
...
// Чтение входящего пакета
private void readMessage(int cbMessage)
{
	int bytesReaden, fResult;
	byte[] buf = new byte [102400];
	fixed (byte* data = buf)
	{
		fResult = ReadFile(
			handleServer,
			data,
			cbMessage,
			&bytesReaden,
			0);
	}
	if (fResult == 0)
	{
		textBox_chat.AppendText("--< Невозможно прочесть данные >--\n");
		return;
	}
	string str = "";
	MsgType type = (MsgType)'e';
	if (buf.Length > 0)
	{
		type = (MsgType)buf[0];
		for (int i = 0; i < bytesReaden; i++)
			str += BitConverter.ToChar(buf,i*2);
		//str = buf.ToString();
		str = str.Remove(0, 1);
	}
	switch (type)
	{
		...
	}		
}
...
                                     
        
            Учебная задача: чат на MailSlot.
Битва с шарпом за указатели, за массивы и т.д.