Почтовые ящики(mailslot) - C#
Формулировка задачи:
Подскажите как сделать этот почтовый ящик?
то есть тот ящик который нужен для обмена сообщениями процессов?
какие классы и т.д для этого используются подскажите хоть
ап!!!
Решение задачи: «Почтовые ящики(mailslot)»
textual
Листинг программы
- using System;
- using System.IO;
- using System.IO.Pipes;
- class PipeServer
- {
- static void Main()
- {
- using (NamedPipeServerStream pipeServer =
- new NamedPipeServerStream("testpipe", PipeDirection.Out))
- {
- Console.WriteLine("NamedPipeServerStream object created.");
- // Wait for a client to connect
- Console.Write("Waiting for client connection...");
- pipeServer.WaitForConnection();
- Console.WriteLine("Client connected.");
- try
- {
- // Read user input and send that to the client process.
- using (StreamWriter sw = new StreamWriter(pipeServer))
- {
- sw.AutoFlush = true;
- Console.Write("Enter text: ");
- sw.WriteLine(Console.ReadLine());
- }
- }
- // Catch the IOException that is raised if the pipe is broken
- // or disconnected.
- catch (IOException e)
- {
- Console.WriteLine("ERROR: {0}", e.Message);
- }
- }
- }
ИИ поможет Вам:
- решить любую задачу по программированию
- объяснить код
- расставить комментарии в коде
- и т.д